wasm-demo/demo/ermis-f/python_m/cur/0653

55 lines
1.4 KiB
Plaintext

From: Bjoern.Giesler at stud.uni-karlsruhe.de (Bjoern Giesler)
Date: Mon, 12 Apr 1999 20:17:52 GMT
Subject: Stupid Tkinter question
References: <99041222110400.01382@dominion>
Message-ID: <99041222210800.02403@dominion>
Content-Length: 1080
X-UID: 653
Hi,
On Mon, 12 Apr 1999 I wrote myself:
[snip]
>[snip]
>#!/usr/bin/env python
>
>from Tkinter import *
>from sys import *
>
>def makeToolbar(aFrame):
> toolbar = Frame(aFrame)
> markimage = BitmapImage(file = "Mark.xbm")
> markbutton = Button(toolbar,
> image = markimage,
> command = exit)
>
> markbutton.pack()
> return toolbar
>
>def makeUI(anApp):
> frame = Frame(anApp)
> toolbar = makeToolbar(frame)
>
> toolbar.pack()
> frame.pack()
>
>app = Tk()
>makeUI(app)
>app.mainloop()
>[snip]
I've just found out why the example above doesn't work: If I add a
"global markimage" to the function makeToolbar, it works. Now my
question: Why does markimage have to be global, since it's only used by
markbutton? And why, by analogy, doesn't markbutton have to be global?
--Bjoern
--
+ thanks for your time, worship the antichrist, and have a nice day /\
+----------------------------------------------------------------- /()\
+ support privacy on the 'net: mail me for pgp public key /____\