[Tutor] wxPython? (fwd)

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Mon, 31 Dec 2001 10:16:18 -0800 (PST)


Hi Karshi,

Let me forward this to the rest of Tutor.  I hate saying this, but I
can't reproduce the wackiness.

The only thing I can think that of that can trigger this behavior is if
divide() itself was defined as:

###
def divide(x,y):
    return x
###

But then, I might not be considering some strange side effect.  Can you
check to see if this is what's happening?  Also, what version of Python
are you using?



---------- Forwarded message ----------
Date: Mon, 31 Dec 2001 09:13:45 -0500
From: Karshi <karshi.hasanov@utoronto.ca>
To: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] wxPython?

Hi Danny,
Can you tell me why I am getting the strange results here:

from Numeric import *

def divide(x,y):
    return x/y

for y in range(-10,10,1):
    x=2
    try:
        print divide(x,y), y
        
    except ZeroDivisionError:
        print "You are trying to divide by zero"
    
----------------

-1 -10
-1 -9
-1 -8
-1 -7
-1 -6
-1 -5
-1 -4
-1 -3
-1 -2
-2 -1
You are trying to divide by zero
2 1
1 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
------------------------------
Why x/y gives wrong results?


On Tuesday 25 December 2001 02:32 pm, you wrote:
> On Mon, 24 Dec 2001, Karshi Hasanov wrote:
> >  I wanna use python GUI's , like wxPython or Tkinter.
> > Which one would be easy to learn, or what 's advantage of using wxPython
> > than Tkinter?
>
> Both are pretty nice.  I think that Tkinter is easier to learn, but many
> people feel that Tkinter looks ugly.  *grin*
>
>
> Tkinter is also installed by default when we install Python, so it's used
> quite a lot.  Have you seen Fredrik Lungh's 'An Introduction to Tkinter'
> web site?
>
>     http://www.pythonware.com/library/tkinter/introduction/
>
> It's a great tutorial on Tkinter programming.  Take a look at it, and see
> if Tkinter is a good fit.
>
> Good luck!