[Tutor] Need some help with wxPython...

2007-09-03 Thread Trey Keown
Hey all, I'm starting to drift away from Tkinter and enter the realm of wxPython. I've recently written a simple text editor in Tkinter, and I would like to know if anyone knows of a good example of a simple wxPython text editor (with the lines properly indented!!!), because all the examples I can

Re: [Tutor] checking if a number is evan or odd

2007-09-03 Thread max baseman
cool thanks the problem was from a math book imp 1 but i already did the work i was just interested in what number had the most steps i could fin wanted to get to 1000 imagine how dismayed i was when it crashed at 965 On Sep 3, 2007, at 8:23 PM, Andrew James wrote: > I'd just go with > > if n

Re: [Tutor] indexing elements

2007-09-03 Thread Ian Witham
Hi, I'm not too sure what your asking here, your code assigns the following to endings: ['st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st'] This is what we would

Re: [Tutor] checking if a number is evan or odd

2007-09-03 Thread Ian Witham
Hi Max, A better way to check if a number is odd or even would be to find the remainder after it is divided by two. for instance: 4 divided by 2 = 2 with 0 remainder 5 divided by 2 = 2 with 1 remainder 6 divided by 2 = 3 with 0 remainder 7

Re: [Tutor] indexing elements

2007-09-03 Thread Kent Johnson
chinni wrote: > Hi all, > > i had some doubt about this line can any body clarify this plz... > endings = ['st', 'nd', 'rd'] + 17 * ['th'] + ['st', 'nd', 'rd'] + 7 * > ['th'] + ['st'] You can try it in the interactive interpreter: In [8]: endings = ['st', 'nd', 'rd'] + 17 * ['th'] + ['st',

[Tutor] binary data struct module

2007-09-03 Thread John
Hello, I have an unformatted mixed type binary file I'm trying to read into Python. So far, I've gotten as far as: f2=file(infile,'rb') Dfmt=['3i','13s','7i','2f','2i','2f','2i','i'] #format for binary reading first bits if f2: print infile + ' has been opened' #for ft in Dfmt: #

[Tutor] Dynamically changing a class

2007-09-03 Thread Jason Doege
Hi All, I'd like to change the behavior of a class' member function dynamically such that, once changed, all objects of the type would see the new behavior. For instance: >>> class MyClass (object) : def mfunc(self, data): print 'pre change behavior' >>> aMyClassObj = MyClass() >>

[Tutor] Metaclass programming

2007-09-03 Thread Orest Kozyar
I have the following code: class meta(type): def __call__(cls, *args, **kwargs): argnames = inspect.getargspec(cls.__init__)[0] for i, value in enumerate(args): kwargs[argnames[i]] = value return type.__call__(cls, kw

[Tutor] checking if a number is evan or odd

2007-09-03 Thread max baseman
hello just a quick check in, it's about the same program i was asking about before ive let it sit for a few days now and i reached a number to high to convert to a decimal by adding 0.0 here's the program: count=1 numstart=268549802 number=0 high=0 a=0 while 1==1: numstart=numstart+1

[Tutor] More class questions

2007-09-03 Thread Ara Kooser
Hello again, Thank you again for your help. I have classes somewhat figured out and I am beginning to understand the syntax involved in using them. What I have so far is a very simple text adventure with two rooms, two items, and some exits. Two question which relates directly to classes: D

[Tutor] indexing elements

2007-09-03 Thread chinni
Hi all, i had some doubt about this line can any body clarify this plz... endings = ['st', 'nd', 'rd'] + 17 * ['th'] + ['st', 'nd', 'rd'] + 7 * ['th'] + ['st'] -- Best Regards, M.Srikanth Kumar, Jr.Software Developer, Google India Pvt Ltd.., HYDERABAD. Phone no: +91-9866774007 _

Re: [Tutor] What's up with Python 2.5.1's IDLE?

2007-09-03 Thread Kent Johnson
Dick Moores wrote: > However, this is what IDLE's shell shows for sys.path: > >>> from sys import path > >>> for x in path: > print x > > > E:\Python25\Lib\idlelib > E:\Python24\lib\site-packages\setuptools-0.6c5-py2.4.egg > C:\WINDOWS\system32\python24.zip > E:\Python25\Lib\idlelib

Re: [Tutor] replacement for .mainloop() in Tk

2007-09-03 Thread Kent Johnson
Trey Keown wrote: > Okay, I'm making a program that turns xml code into python code. > > And here would be the corresponding output (well, what I've got so far...) > > > from Tkinter import * > import tkFileDialog > ## > self = Tk() > self.title("Example Windo

Re: [Tutor] What's up with Python 2.5.1's IDLE?

2007-09-03 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > Under Kent's tutelage, I've been experimenting with having no > PYTHONDOC, I assume you mean PYTHONPATH? > and instead putting a .pth file in > E:\Python25\lib\site-packages\ I named pointers.pth. I obviously failed to convince you of the superior flexi

Re: [Tutor] replacement for .mainloop() in Tk

2007-09-03 Thread Alan Gauld
"Trey Keown" <[EMAIL PROTECTED]> wrote > > from Tkinter import * > import tkFileDialog > ## > self = Tk() Using self here is a little bit unconventional sinmce its not in a class. That could confuse some readers. > self.title("Example Window Title") > self.i