Re: [Tkinter-discuss] Unexpected Checkbutton behaviour

2006-11-28 Thread Fredrik Lundh
Gerardo Juarez wrote: > I'm having problems with a widget, which I've been able to isolate to the > following example: > > from Tkinter import * > > def display(): > global x > print x > > root = Tk() > x = 0 > check = Checkbutton(root, variable=x) > check.pack() > button = Button(te

Re: [Tkinter-discuss] Unexpected Checkbutton behaviour

2006-11-28 Thread Cam
Hi Gerardo, You can't user a regular python variable for "x", you need to create, in this case, an IntVar "control variable". See revised code below, also see http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html Cam Farnell from Tkinter import * def display(): print x.g

[Tkinter-discuss] Unexpected Checkbutton behaviour

2006-11-28 Thread Gerardo Juarez
Hi, I'm having problems with a widget, which I've been able to isolate to the following example: from Tkinter import * def display(): global x print x root = Tk() x = 0 check = Checkbutton(root, variable=x) check.pack() button = Button(text='Display variable', command=display) butto

Re: [Tkinter-discuss] How to dettach a Toplevel

2006-11-28 Thread Sorin Schwimmer
Hi Michael, I see your point, but this is not what I am looking for. What I'm trying to achieve goes on the following lines: the user has a GUI and works. A daemon (I'm on Linux) receives a message for the user, so it pops-up a little notification symbol (there is actualy a bit more inter-proce

Re: [Tkinter-discuss] How to dettach a Toplevel

2006-11-28 Thread Michael Lange
On Tue, 28 Nov 2006 09:25:06 -0800 (PST) Sorin Schwimmer <[EMAIL PROTECTED]> wrote: > Hi, > > If I have: > > > from Tkinter import * > root=Tk() > tl=Toplevel() > root.mainloop() > > > and then close the root window, it will take tl with it. Is there a way to > keep tl alive after root dies?

[Tkinter-discuss] A small fix for NoteBook in Tix

2006-11-28 Thread Sorin Schwimmer
Problem: >>> from Tix import * >>> root=Tk() >>> nb=NoteBook(root) >>> nb.add('pg_1', label='pg 1') >>> nb.pages() Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib/python2.4/lib-tk/Tix.py", line 1160, in pages ret.append(self.subwidget(x)) File "/usr/local/l

Re: [Tkinter-discuss] Stumped

2006-11-28 Thread Cam
The "global" was omitted when I cut the code down to a skeleton example; it's in my big program. I have avoided "update" for the same reason. Even the New Mexico Tech documentation (http://infohost.nmt.edu/tcc/help/pubs/tkinter/universal.html) says never to use "update" inside a callback. Thus

Re: [Tkinter-discuss] Stumped

2006-11-28 Thread Bob Greschke
- Original Message - From: Sorin Schwimmer To: tkinter-discuss@python.org Sent: Tuesday, November 28, 2006 11:42 AM Subject: Re: [Tkinter-discuss] Stumped I never tried Bob's Greschke idea of using update() in a callback, because of this reason: http://www.pythonware.com/library/tkinter

Re: [Tkinter-discuss] Stumped

2006-11-28 Thread Sorin Schwimmer
I never tried Bob's Greschke idea of using update() in a callback, because of this reason: http://www.pythonware.com/library/tkinter/introduction/x9374-event-processing.htm Sorin __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam pro

Re: [Tkinter-discuss] Stumped

2006-11-28 Thread Bob Greschke
Adding the - lines seems to work. > from Tkinter import * > import time > > def on_button(): > for J in range(10): > print J > if CancelNow: > break > time.sleep(1) -- Root.update() > > def Cancel(Event): -- global CancelNow > print 'Cancel

Re: [Tkinter-discuss] Stumped

2006-11-28 Thread Sorin Schwimmer
Add in your functions, first statement after def global CancelNow This way everybody refers *the same* flag. I would normally move your second-last statement (CancelNow = False) just below imports. De-stumped? Sorin ___

[Tkinter-discuss] Stumped

2006-11-28 Thread Cam
This is probably really simple but I haven't yet figured it out. It happens in the context of a much larger program but stripped to it's essence is per the little program below. The general idea is that the user clicks on a button, that initiates an operation which is going to take some time, s

[Tkinter-discuss] How to dettach a Toplevel

2006-11-28 Thread Sorin Schwimmer
Hi, If I have: from Tkinter import * root=Tk() tl=Toplevel() root.mainloop() and then close the root window, it will take tl with it. Is there a way to keep tl alive after root dies? Thanks, Sorin Yaho