Version upgrade blocked mentally

2008-11-29 Thread Adam E
I have read in my copy of Programming Python that all strings will be
Unicode and there will be a byte type.

This is mentally keeping me from upgrading to 2.6 .

I'm curious, but are there still some who prefer Python 2.5?
I don't mind constructive criticsm.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter, toplevel and images

2008-08-22 Thread Adam E
On Aug 22, 9:17 am, Pedro <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm trying to build a small application that can display some images
> in a toplevel window. I have this code:
>
> def Results(master):
> from Tkinter import Toplevel, Button, Label
> from PIL import ImageTk
>
> figures = ['first.png', 'second.png']
>
> ResultsWindow = Toplevel(master)
> ResultsWindow.title('Results')
>
> picts = [ImageTk.PhotoImage(file = x) for x in figures]
>
> butRW = Button(ResultsWindow, text = 'CLOSE', command =
> ResultsWindow.destroy)
> butRW.pack()
>
> height = sum([x.height() for x in picts])
> width = picts[0].width()
>
> y = 0
> for pict in picts:
> label = Label(ResultsWindow,image=pict).pack()
> y += pict.height()
>
> from Tkinter import Tk
> root = Tk()
> Results(root)
> root.mainloop()
>
> and I just can see a grey window with a "close" button... However,
> when I try the same code with the root I can see both images... Can
> anyone give me a tip?
>
> Thanks! :)

You can try making a class for the Tkinter.Toplevel window.  I don't
have PIL, but I know if you query for a widget's value when the window
is not yet displayed, it will give a nearly 0-by-0 size result.

You can also try to set a size for the Toplevel window and see if the
images display.

I have not encountered this before, but I only know what I have read
from books (like Programming Python by O'Reilly) and have assumed.

Good luck.
--
http://mail.python.org/mailman/listinfo/python-list


Re: rules of thumb for cross os code

2008-08-22 Thread Adam E
On Aug 22, 9:55 am, DwBear75 <[EMAIL PROTECTED]> wrote:
> I am considering using python as a replacement for a lot of bash
> scripting that I have been doing. I would like to be as cross platform
> as possible, writing scripts for both windows and linux. Are there any
> guides are general rules of thumb on
> 1) keeping code os independant
> 2) nifty lambda's or other things to create functions fit for the
> environment
> 3) capturing return codes of other executables called from python; ie
> use os.system, or popen? or ?

you can try Programming Python 3rd Edition from O'Reilly or, at least,
the code for the book, which you can get from the author's site:
http://www.rmi.net/~lutz/
Note: it contains code for Python 2.4, but I never encountered any of
the code to not work when I tried it.  There is one directory that
contains out-of-date code, which you should find easily when reading
the text files.


I'm sorry that I can only help by referring you to Python 2.4 code.
But it is useful -- PyMailGUI and PyMailCGI are great examples, just
be careful not to be fed up with the large, high-level examples.
--
http://mail.python.org/mailman/listinfo/python-list