[Tutor] Images + Tkinter

Magnus Lycka magnus@thinkware.se
Sun Nov 17 15:08:01 2002


At 15:09 2002-11-17 +0100, Hans Gubitz wrote:
>With this explanation I found two solutions:

>def fenster(tk):
...
>    return photo

I find it a bit confusing that a function "fenster"
(means window) that creates and populates a Frame
would return a photo. If I hadn't seen this discussion
and saw that in a program I'd wonder what this was
about. (If you need to write a comment to explain why
you do a strange thing, it's a good thing to think about
changing the structure of the code instead...)

>class Application:
>     def __init__(self, master):
>         frame = Tkinter.Frame(master)
>         frame.pack()
>
>         self.photo=Tkinter.PhotoImage(file="bluecher.gif")
>#       ^^^^

This is what I would do. (Maybe I'd write a comment anyway.)


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se