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
> 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
---
>
##
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
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
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
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
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
__
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
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
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:
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:
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
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.
__
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
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
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
All right! That's penetrated. Thanks very much.
ds
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
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
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
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
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
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
| 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
> 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
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
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
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
_
Dont just
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
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,
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
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
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
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
> 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
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
>
>>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
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 =
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
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
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
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()
>
>
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
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
> 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:/
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
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
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
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
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
49 matches
Mail list logo