Re: [Tutor] geometry

2005-11-07 Thread Shi Mu
Because i am also teaching some introduction courses of programming in middle school, I prefer some 2D geometry codes. On 11/7/05, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote: > > | any python code for middle school geometry teaching use? > | for instance, calculate the polygon area size, ove

[Tutor] TKinter Question

2005-11-07 Thread Rob Dowell
Just a quick TKinter question. Is it possible to have custom frames/widgets? In other words can I customize the way that the GUI looks (i.e. rounded corners on the frames, beveled/raised edges, etc.) I was just wondering if it was possible and if it is possible then where I might get some infor

Re: [Tutor] Namespace Problem

2005-11-07 Thread Carroll, Barry
Kent: Thank you for the explanation. This is a subtlety of Python that has tripped me up before. Barry > Date: Mon, 07 Nov 2005 16:26:39 -0500 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Namespace Problem > Cc: "'tutor@python.org'" > Message-ID: <[EMAIL PROTECTED]> > Cont

Re: [Tutor] Does Pygame allow background images?

2005-11-07 Thread Liam Clarke-Hutchinson
Oh dear, The full code would be (hopefully correct this time) import sys, pygame pygame.init() ball = pygame.image.load("ball.bmp") background = pygame.image.load("bckgrnd.bmp") ballrect = ball.get_rect() backgroundRect = background.get_rect() size = (width, height) = background.get_size() scr

Re: [Tutor] Does Pygame allow background images?

2005-11-07 Thread Liam Clarke-Hutchinson
Hi Nathan, Just create a surface the same size as your screen, and have a loop like so while True: Here's some rough code to add a background for that ball one I posted yesterday. Bear in mind that I can't check this at work. Lines with !! are new- import sys, pygame pygame.i

Re: [Tutor] Does Pygame allow background images?

2005-11-07 Thread R. Alan Monroe
> Does Pygame allow background images (i.e. a hockey rink for a hockey game)? Sure... just check out the supplied chimp.py example, which has a message in the background, and two sprites on top of it. Alan ___ Tutor maillist - Tutor@python.org http:/

[Tutor] Does Pygame allow background images?

2005-11-07 Thread Nathan Pinno
Hey all,   Does Pygame allow background images (i.e. a hockey rink for a hockey game)?   Thanks, Nathan Pinno ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [OT] Mono

2005-11-07 Thread Liam Clarke-Hutchinson
Hi Matt, The main advantage of IronPython is access to the .NET framework in Python. For most Python scripts I run, there is no speed advantage due to the overhead of loading the framework (but then, I have an old computer.) But, I like being able to poke .NET within a Python environment, as I di

Re: [Tutor] Error message with testing Tkinter

2005-11-07 Thread Danny Yoo
On Mon, 7 Nov 2005, Double Six wrote: > I'm learning Tkinter with the following code on Mac OS X 10.4: > > from Tkinter import * > from sys import stdout, exit > widget = Button(None, text = 'Hello?', command=(lambda: > stdout.write('Hello?\n') or exit())) > widget.pack() > widget.mainloop() > >

Re: [Tutor] Namespace Problem

2005-11-07 Thread Kent Johnson
Carroll, Barry wrote: > Bob: > > Yes I did mean 'import' and yes there is more to the function. Here is the > entire program. > > > import socket > import struct > > # data packet flags > ABC = 1 > DEF = 2 > GHI = 4 > JKL = 8 > seq = 0 > > buf = 8192 # This is the ma

Re: [Tutor] Easier way to access wxPython

2005-11-07 Thread Liam Clarke-Hutchinson
For wxPython - Wax is alright, Pythoncard is great. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Tuesday, 8 November 2005 8:31 a.m. Cc: Python Tutor Subject: Re: [Tutor] Easier way to access wxPython Matt Williams wrote: > Dear All

[Tutor] Error message with testing Tkinter

2005-11-07 Thread Double Six
Hi, I'm learning Tkinter with the following code on Mac OS X 10.4: from Tkinter import * from sys import stdout, exit widget = Button(None, text = 'Hello?', command=(lambda: stdout.write('Hello?\n') or exit())) widget.pack() widget.mainloop() I do successfully get a GUI with a button, but the pr

Re: [Tutor] Namespace Problem

2005-11-07 Thread Carroll, Barry
Bob: Yes I did mean 'import' and yes there is more to the function. Here is the entire program. import socket import struct # data packet flags ABC = 1 DEF = 2 GHI = 4 JKL = 8 seq = 0 buf = 8192 # This is the max_packet_size defined in the SocketServer module addr =

Re: [Tutor] simple report writing?

2005-11-07 Thread alan . gauld
> >>Can someone suggest a specific tutorial strictly >>on report writing? >> >>to be able to control left and right justification, ... It doesn't sound like you need a tutorial per se, simply to spend some time with Pythons format strings - like C printf() Otherwise the only other advice I'd g

Re: [Tutor] simple report writing?

2005-11-07 Thread Liam Clarke-Hutchinson
Hi RC, >I have a list (x_list) of class data. So, a list of instances/classes then. You'll have to pass a custom function. def tSort(objA,objB): #assuming that objA.x & objB.x are the items to sort by, and are integers if objA < objB: result = -1 elif objA = objB: r

Re: [Tutor] Mono

2005-11-07 Thread Danny Yoo
> Slightly off topic, but could someone explain/ point me to a URL that > explains how one might use Python with Mono (I guess it would be > IronPython, rather than CPython), and what advantages it might give you > (apart from a possible speed up of IronPython vs. CPython). I'm > especially intere

[Tutor] Is Python a good choise for this project?

2005-11-07 Thread bruno
Hey, > > Python is capable of building such a system if thats what you mean. > Proivided high performance (real time rapid animation say) is not required > then it should perform adequately. Yes, performance is not a great concern. > But it will require quite a bit of > learning, > not ju

Re: [Tutor] simple report writing?

2005-11-07 Thread CPIM Ronin
I neglected to mention that the list x_list was created by x_list = [] and then a series of x_list.append(y), where y are class instances with a variety of variables, one of which I want to use as a sort key. >I have a list (x_list) of class data. How do I sort that list by a selected >variable

Re: [Tutor] Easier way to access wxPython

2005-11-07 Thread Kent Johnson
Matt Williams wrote: > Dear All, > > Just a note: When the next question about "which GUI for Python" comes > around (and I should plead guilty to having asked a few times) I thought > that the Dabo framework, which wraps wxPython in a nicer API would be > worth pointing to. > > http://daboenv.co

Re: [Tutor] simple report writing?

2005-11-07 Thread Kent Johnson
CPIM Ronin wrote: > I have a list (x_list) of class data. How do I sort that list by a > selected variable common to all members of the list? > > x_list.sort(key=x_list.v_name) # doesn't work becuase x_list can't see > the individual items. Use import operator x_list.sort(key=operator.attrgette

Re: [Tutor] simple report writing?

2005-11-07 Thread Kent Johnson
CPIM Ronin wrote: > Can someone suggest a specific tutorial strictly on report writing? > > I'm able to write reports fairly easily in Python. I know the stuff like > str(round(x,2)) where x = 3.145678 will yield 3.14. What I'm looking for is > to be able to control left and right justification,

[Tutor] Mono

2005-11-07 Thread Matt Williams
Dear List, Slightly off topic, but could someone explain/ point me to a URL that explains how one might use Python with Mono (I guess it would be IronPython, rather than CPython), and what advantages it might give you (apart from a possible speed up of IronPython vs. CPython). I'm especially inter

[Tutor] simple report writing?

2005-11-07 Thread CPIM Ronin
I have a list (x_list) of class data. How do I sort that list by a selected variable common to all members of the list? x_list.sort(key=x_list.v_name) # doesn't work becuase x_list can't see the individual items. RC _ Don’t just

[Tutor] Easier way to access wxPython

2005-11-07 Thread Matt Williams
Dear All, Just a note: When the next question about "which GUI for Python" comes around (and I should plead guilty to having asked a few times) I thought that the Dabo framework, which wraps wxPython in a nicer API would be worth pointing to. And even if the question didn't get asked, I thought p

[Tutor] simple report writing?

2005-11-07 Thread CPIM Ronin
Can someone suggest a specific tutorial strictly on report writing? I'm able to write reports fairly easily in Python. I know the stuff like str(round(x,2)) where x = 3.145678 will yield 3.14. What I'm looking for is to be able to control left and right justification, column by column while usi

Re: [Tutor] base64MIME module import error

2005-11-07 Thread Eddie S
> The problem is that your email.py module is shadowing the library email > module. Python is looking for base64MIME in your module. Rename your email.py > to something else and it should work. > > Kent > > -- > http://www.kentsjohnson.com > > ___ > Tut

Re: [Tutor] geometry

2005-11-07 Thread Chris or Leslie Smith
| any python code for middle school geometry teaching use? | for instance, calculate the polygon area size, overlaid area size? | Thanks. | Yes, the module I refered to in response to the email with subject "Overlay" will handle these calculations. Again, see ( http://www.dezentral.de/warp.ht

Re: [Tutor] base64MIME module import error

2005-11-07 Thread Kent Johnson
Eddie S wrote: > I was just trying to make a simple cgi email form when I encountered > this error. > > Traceback (most recent call last): > File "/Users/eddie/Sites/python/email.py", line 4, in ? > import smtplib > File > "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/pyth

[Tutor] base64MIME module import error

2005-11-07 Thread Eddie S
I was just trying to make a simple cgi email form when I encountered this error. Traceback (most recent call last): File "/Users/eddie/Sites/python/email.py", line 4, in ? import smtplib File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/smtplib.py", line 49, in

Re: [Tutor] Percentage

2005-11-07 Thread Pujo Aji
nice syntax.   Cheers, pujo  On 07 Nov 2005 12:18:44 -0200, Jorge Godoy <[EMAIL PROTECTED]> wrote: Pujo Aji <[EMAIL PROTECTED]> writes:> don't forget to use dot or converge into float. Or import division from __future__.>>> from __future__ import division>>> 42 / 2500.16801>>>--Jorg

Re: [Tutor] Percentage

2005-11-07 Thread Frank Moore
Johan Geldenhuys wrote: > Wow, you gave 105% on this one. ;-) > You're right. I misread the question and thought that you wanted 42% of 250. My mistake. Cheers, F. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Pujo Aji <[EMAIL PROTECTED]> writes: > don't forget to use dot or converge into float. Or import division from __future__. >>> from __future__ import division >>> 42 / 250 0.16801 >>> -- Jorge Godoy <[EMAIL PROTECTED]> ___ Tutor m

Re: [Tutor] Object instances

2005-11-07 Thread DS
All right! That's penetrated. Thanks very much. ds ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Steve Nelson <[EMAIL PROTECTED]> writes: > Don't you need to specify one of these numbers as a float? You do. My mistake and I haven't seen both corrections before sending my last message. :-) > I recall reading somewhere that all division would be 'true division' > from >3.0 but this isn't the

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Frank Moore <[EMAIL PROTECTED]> writes: > Johan, > > You could try: > > percentage = (42 * 250)/100 > > This gives the answer 105. And that sounds weird, doesn't it? 42 is smaller than 250, so I'd expect it to be less than 100% of the value... In fact, it is >>> 42.0/250 0.1680

Re: [Tutor] Percentage

2005-11-07 Thread Steve Nelson
On 07 Nov 2005 11:50:05 -0200, Jorge Godoy <[EMAIL PROTECTED]> wrote: > Johan Geldenhuys <[EMAIL PROTECTED]> writes: > > > What is the syntax if I want to work out what percentage 42 is out of 250? > > If you want it as a factor to multiply / divide by something: > > perc = 42/250 Don't you need t

Re: [Tutor] Percentage

2005-11-07 Thread Johan Geldenhuys
Wow, you gave 105% on this one. ;-) Frank Moore wrote: Johan Geldenhuys wrote: Hi all, What is the syntax if I want to work out what percentage 42 is out of 250? Johan, You could try: percentage = (42 * 250)/100 This gives the answer 105. Cheers, F. __

Re: [Tutor] Percentage

2005-11-07 Thread Pujo Aji
don't forget to use dot or converge into float.perc = 42./250or perc = float(42)/250otherwise:it is treated as integer.pujoOn 07 Nov 2005 11:50:05 -0200, Jorge Godoy <[EMAIL PROTECTED]> wrote: Johan Geldenhuys <[EMAIL PROTECTED]> writes:> What is the syntax if I want to work out what percentage 42

Re: [Tutor] Percentage

2005-11-07 Thread Johan Geldenhuys
I have it like that, just thought there could be another way. 8-) Jorge Godoy wrote: Johan Geldenhuys <[EMAIL PROTECTED]> writes: What is the syntax if I want to work out what percentage 42 is out of 250? If you want it as a factor to multiply / divide by something:

Re: [Tutor] Percentage

2005-11-07 Thread Frank Moore
Johan Geldenhuys wrote: >Hi all, > >What is the syntax if I want to work out what percentage 42 is out of 250? > > Johan, You could try: percentage = (42 * 250)/100 This gives the answer 105. Cheers, F. ___ Tutor maillist - Tutor@python.org http:

Re: [Tutor] geometry

2005-11-07 Thread Kent Johnson
Shi Mu wrote: > any python code for middle school geometry teaching use? > for instance, calculate the polygon area size, overlaid area size? You might be interested in PyGeo. I think it is more oriented toward visualization than calculation but it is definitely intended to aid in teaching geome

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Johan Geldenhuys <[EMAIL PROTECTED]> writes: > What is the syntax if I want to work out what percentage 42 is out of 250? If you want it as a factor to multiply / divide by something: perc = 42/250 If you want it to "read" as percentage: perc_100 = (42/250)*100 Sds, -- Jorge Godoy <[EM

[Tutor] Re; Geometry

2005-11-07 Thread Greg Lindstrom
If there's not code for geometry, let's write some!!  What, precisely, are you looking for?  Or, better yet, do you have the resources to have you students write the code after teaching them "just enough" python?  I did that with a physics class a few years ago and the students loved it! --greg __

[Tutor] Percentage

2005-11-07 Thread Johan Geldenhuys
Hi all, What is the syntax if I want to work out what percentage 42 is out of 250? TIA, ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] geometry

2005-11-07 Thread Shi Mu
any python code for middle school geometry teaching use? for instance, calculate the polygon area size, overlaid area size? Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] click and line

2005-11-07 Thread Shi Mu
Danny, You are right. Thanks for your great patience and kindness. Shi On 11/7/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > > it works now. > > Hi Shi Mu, > > Can you describe how you fixed it? The only diff between the two programs > that I see is that you repositioned the setting of the frame

Re: [Tutor] no error no result

2005-11-07 Thread Danny Yoo
On Sun, 6 Nov 2005, Shi Mu wrote: > when I read some python sample codes. > I found that several of them need "python -i" to run them or you will > not get any result though the program does not report any error. > I really can not understand it. Hi Shi Mu, Ok, let's compare-and-constrast. Ca

Re: [Tutor] click and line

2005-11-07 Thread Danny Yoo
> it works now. Hi Shi Mu, Can you describe how you fixed it? The only diff between the two programs that I see is that you repositioned the setting of the frame variable. # mumak:~ dyoo$ diff t1.txt t2.txt 6c6 < --- > frame = c 16c16 < frame = c --- > ##

[Tutor] image

2005-11-07 Thread Shi Mu
why the follwoing code report the error: Traceback (most recent call last): File "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict__ File "C:\Python23\Examples\AppB\text.py", line 24, in ? text.image_creat