From FBatista at uniFON.com.ar Wed Jun 9 14:39:44 2004 From: FBatista at uniFON.com.ar (Batista, Facundo) Date: Wed Jun 9 14:43:07 2004 Subject: [Tkinter-discuss] Button look Message-ID: Have a simple GUI. One text entry, two buttons. When you press each button, something is done with the text you entered and it takes about 10 seconds. I want the first button to be triggered with the Enter key. So I binded the key to the same function that the button. It works but I also want that the button look "pressed" when I press the key and the function starts, and look "unpressed" when the function finishes. How can I tell the button to look "pressed" and "unpressed"? I'm on Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32. Thank you! Facundo Batista Desarrollo de Red fbatista@unifon.com.ar (54 11) 5130-4643 Cel: 15 5132 0132 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ADVERTENCIA La informaci?n contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener informaci?n confidencial o propietaria, cuya divulgaci?n es sancionada por la ley. Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no est? autorizado a divulgar, copiar, distribuir o retener informaci?n (o parte de ella) contenida en este mensaje. Por favor notif?quenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magn?tico) que pueda haber realizado del mismo. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telef?nica Comunicaciones Personales S.A. o alguna empresa asociada. Los mensajes electr?nicos pueden ser alterados, motivo por el cual Telef?nica Comunicaciones Personales S.A. no aceptar? ninguna obligaci?n cualquiera sea el resultante de este mensaje. Muchas Gracias. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20040609/86454ca7/attachment.html From FBatista at uniFON.com.ar Wed Jun 9 14:39:42 2004 From: FBatista at uniFON.com.ar (Batista, Facundo) Date: Wed Jun 9 14:43:18 2004 Subject: [Tkinter-discuss] Pointer busy Message-ID: Have a simple GUI. One text entry, two buttons. When you press each button, something is done with the text you entered and it takes about 10 seconds. You can click on any button. But when you click on it, I want the mouse pointer to show the sand clock. So I put this code: root.config(cursor="wait") textoOut = funcion(textoIn) root.config(cursor="") This does NOT work, but if I put this: root.config(cursor="wait") print "starting..." textoOut = funcion(textoIn) print "ending..." root.config(cursor="") Works OK! Do you know why? I need some kind of flush? I'm on Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32. Thank you! Facundo Batista Desarrollo de Red fbatista@unifon.com.ar (54 11) 5130-4643 Cel: 15 5132 0132 From mike at nospam.com Wed Jun 9 15:01:13 2004 From: mike at nospam.com (Mike Rovner) Date: Wed Jun 9 15:20:43 2004 Subject: [Tkinter-discuss] Re: Button look References: Message-ID: Button look "Batista, Facundo" wrote in message How can I tell the button to look "pressed" and "unpressed"? Make it checkbutton -variable x -indicator 0 when you set x to 1 it checks, to 0 - unchecks HTH, Mike From claird at lairds.com Wed Jun 9 15:41:11 2004 From: claird at lairds.com (Cameron Laird) Date: Wed Jun 9 15:41:16 2004 Subject: [Tkinter-discuss] Re: Button look In-Reply-To: Message-ID: > From tkinter-discuss-bounces@python.org Wed Jun 09 14:20:44 2004 > Envelope-to: claird@phaseit.net > X-Injected-Via-Gmane: http://gmane.org/ > To: tkinter-discuss@python.org > From: "Mike Rovner" > . > . > . > Button look > "Batista, Facundo" wrote in message > How can I tell the button to look "pressed" and "unpressed"? > Make it checkbutton -variable x -indicator 0 > when you set x to 1 it checks, to 0 - unchecks > . > . > . Whoa! I think that is FAR from the most satisfying answer. Facundo, the idea I think you're after is, rather than to bind to the same function as the button, to bind it to the button's activate() method. While I can't make time now to explain that coherently, I suspect that one keyword will set you in the right direction. From FBatista at uniFON.com.ar Wed Jun 9 16:16:38 2004 From: FBatista at uniFON.com.ar (Batista, Facundo) Date: Wed Jun 9 16:19:37 2004 Subject: [Tkinter-discuss] Re: Button look Message-ID: [Mike Rovner] #- Make it checkbutton -variable x -indicator 0 #- when you set x to 1 it checks, to 0 - unchecks Too ulgy. I don't want a checkbutton, just a button. . Facundo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ADVERTENCIA La informaci?n contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener informaci?n confidencial o propietaria, cuya divulgaci?n es sancionada por la ley. Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no est? autorizado a divulgar, copiar, distribuir o retener informaci?n (o parte de ella) contenida en este mensaje. Por favor notif?quenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magn?tico) que pueda haber realizado del mismo. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telef?nica Comunicaciones Personales S.A. o alguna empresa asociada. Los mensajes electr?nicos pueden ser alterados, motivo por el cual Telef?nica Comunicaciones Personales S.A. no aceptar? ninguna obligaci?n cualquiera sea el resultante de este mensaje. Muchas Gracias. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20040609/f8affd6d/attachment.html From FBatista at uniFON.com.ar Wed Jun 9 16:18:50 2004 From: FBatista at uniFON.com.ar (Batista, Facundo) Date: Wed Jun 9 16:21:53 2004 Subject: [Tkinter-discuss] Re: Button look Message-ID: [Cameron Laird] #- Facundo, the idea I think you're after is, rather than to #- bind to the same function as the button, to bind #- it to the button's activate() method. While I can't make #- time now to explain that coherently, I suspect that one #- keyword will set you in the right direction. Instead of calling the function "manually" I can do button.invoke() and it calls the function. But, it does not press and unpress the button! Button does not have an activate method, nor an activate option. The closer is the button state (ACTIVE, NORMAL or DISABLED), but it does not have that effect. . Facundo From jepler at unpythonic.net Wed Jun 9 18:14:31 2004 From: jepler at unpythonic.net (Jeff Epler) Date: Wed Jun 9 18:14:44 2004 Subject: [Tkinter-discuss] Button look In-Reply-To: References: Message-ID: <20040609221431.GA5451@unpythonic.net> On Wed, Jun 09, 2004 at 03:39:44PM -0300, Batista, Facundo wrote: > I want the first button to be triggered with the Enter key. So I binded the > key to the same function that the button. > > It works but I also want that the button look "pressed" when I press the key > and the function starts, and look "unpressed" when the function finishes. Use this button_invoker() in the binding. Here I bound the button widget, but on re-reading your text it sounds like you want to place this binding on the toplevel containing the button, so that hitting Enter anywhere in that window triggers the button. import time from Tkinter import Button def button_invoker(event): w = event.widget old_relief = w.cget('relief') w.configure(relief='sunken') w.update_idletasks() try: w.invoke() finally: w.configure(relief=old_relief) b = Button(command = lambda: time.sleep(5)) b.bind("", button_invoker) b.pack() b.focus() b.mainloop() -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20040609/dfc41e4c/attachment.bin From mike at nospam.com Wed Jun 9 20:15:13 2004 From: mike at nospam.com (Mike Rovner) Date: Wed Jun 9 20:15:19 2004 Subject: [Tkinter-discuss] Re: Re: Button look References: Message-ID: Cameron Laird wrote: >> . >> Button look >> "Batista, Facundo" wrote in message >> How can I tell the button to look "pressed" and "unpressed"? > >> Make it checkbutton -variable x -indicator 0 >> when you set x to 1 it checks, to 0 - unchecks >> . > Whoa! I think that is FAR from the most satisfying answer. It's rather short but exact answer to the asked question. Cameron, please comment what wrong in my answer, so I can learn on mistakes. > Facundo wrote: >Too ulgy. I don't want a checkbutton, just a button. Facundo, with indicator=0 it looks _exactly_ like button. What is ugly? Mike From claird at lairds.com Thu Jun 10 13:52:44 2004 From: claird at lairds.com (Cameron Laird) Date: Thu Jun 10 13:52:58 2004 Subject: [Tkinter-discuss] Re: Re: Button look In-Reply-To: Message-ID: > From tkinter-discuss-bounces@python.org Wed Jun 09 19:15:22 2004 > Envelope-to: claird@phaseit.net > X-Injected-Via-Gmane: http://gmane.org/ > To: tkinter-discuss@python.org > From: "Mike Rovner" > >> . > >> Button look > >> "Batista, Facundo" wrote in message > >> How can I tell the button to look "pressed" and "unpressed"? > > > >> Make it checkbutton -variable x -indicator 0 > >> when you set x to 1 it checks, to 0 - unchecks > >> . > > Whoa! I think that is FAR from the most satisfying answer. > It's rather short but exact answer to the asked question. > Cameron, please comment what wrong in my answer, so I can learn on mistakes. > > Facundo wrote: > >Too ulgy. I don't want a checkbutton, just a button. > Facundo, with indicator=0 it looks _exactly_ like button. What is ugly? > . > . > . Mike, I was just wrong. Please refer to Jeff's follow-up; he has everything I had in mind, and more. I apologize for spreading false information. *I* am the one, at least this time, with an opportunity to learn from my mistake. From klappnase at freenet.de Thu Jun 10 15:56:09 2004 From: klappnase at freenet.de (Michael Lange) Date: Thu Jun 10 16:03:28 2004 Subject: [Tkinter-discuss] Button look In-Reply-To: References: Message-ID: <20040610215609.032942e9.klappnase@freenet.de> On Wed, 9 Jun 2004 15:39:44 -0300 "Batista, Facundo" wrote: > Have a simple GUI. > > One text entry, two buttons. When you press each button, something is done > with the text you entered and it takes about 10 seconds. > > I want the first button to be triggered with the Enter key. So I binded the > key to the same function that the button. > > It works but I also want that the button look "pressed" when I press the key > and the function starts, and look "unpressed" when the function finishes. > > How can I tell the button to look "pressed" and "unpressed"? > > I'm on Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] > on win32. > > Thank you! I don't have a win32 box here, on my linux box the following works fine: class Mybutton(Tkinter.Button): def __init__(self, master, **kw): Tkinter.Button.__init__(self, master, **kw) self.bind('', lambda event: self.event_generate('')) and then use the Mybutton class like a regular Tkinter.Button. Michael From klappnase at freenet.de Thu Jun 10 16:01:38 2004 From: klappnase at freenet.de (Michael Lange) Date: Thu Jun 10 16:03:29 2004 Subject: [Tkinter-discuss] Pointer busy In-Reply-To: References: Message-ID: <20040610220138.083eafd2.klappnase@freenet.de> On Wed, 9 Jun 2004 15:39:42 -0300 "Batista, Facundo" wrote: > Have a simple GUI. > > One text entry, two buttons. When you press each button, something is done > with the text you entered and it takes about 10 seconds. > > You can click on any button. But when you click on it, I want the mouse > pointer to show the sand clock. So I put this code: > > root.config(cursor="wait") > textoOut = funcion(textoIn) > root.config(cursor="") > > This does NOT work, but if I put this: > > root.config(cursor="wait") > print "starting..." > textoOut = funcion(textoIn) > print "ending..." > root.config(cursor="") > > Works OK! > > Do you know why? I need some kind of flush? > > I'm on Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] > on win32. > > Thank you! > I'm afraid I cannot really answer your question, but I guess that using root.config(cursor="wait") root.update_idletasks() ..etc... should do the trick, at least that's what I normally do in such cases. Michael From klappnase at web.de Thu Jun 10 16:05:09 2004 From: klappnase at web.de (Michael Lange) Date: Thu Jun 10 16:03:45 2004 Subject: [Tkinter-discuss] Button look In-Reply-To: References: Message-ID: <20040610220509.74a0ac0d.klappnase@web.de> On Wed, 9 Jun 2004 15:39:44 -0300 "Batista, Facundo" wrote: > Have a simple GUI. > > One text entry, two buttons. When you press each button, something is done > with the text you entered and it takes about 10 seconds. > > I want the first button to be triggered with the Enter key. So I binded the > key to the same function that the button. > > It works but I also want that the button look "pressed" when I press the key > and the function starts, and look "unpressed" when the function finishes. > > How can I tell the button to look "pressed" and "unpressed"? > > I'm on Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] > on win32. > > Thank you! I don't have a win32 box here, on my linux box the following works fine: class Mybutton(Tkinter.Button): def __init__(self, master, **kw): Tkinter.Button.__init__(self, master, **kw) self.bind('', lambda event: self.event_generate('')) and then use the Mybutton class like a regular Tkinter.Button. Michael From klappnase at web.de Thu Jun 10 16:05:20 2004 From: klappnase at web.de (Michael Lange) Date: Thu Jun 10 16:03:56 2004 Subject: [Tkinter-discuss] Pointer busy In-Reply-To: References: Message-ID: <20040610220520.524681f3.klappnase@web.de> On Wed, 9 Jun 2004 15:39:42 -0300 "Batista, Facundo" wrote: > Have a simple GUI. > > One text entry, two buttons. When you press each button, something is done > with the text you entered and it takes about 10 seconds. > > You can click on any button. But when you click on it, I want the mouse > pointer to show the sand clock. So I put this code: > > root.config(cursor="wait") > textoOut = funcion(textoIn) > root.config(cursor="") > > This does NOT work, but if I put this: > > root.config(cursor="wait") > print "starting..." > textoOut = funcion(textoIn) > print "ending..." > root.config(cursor="") > > Works OK! > > Do you know why? I need some kind of flush? > > I'm on Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] > on win32. > > Thank you! > I'm afraid I cannot really answer your question, but I guess that using root.config(cursor="wait") root.update_idletasks() ..etc... should do the trick, at least that's what I normally do in such cases. Michael From jozerskiy at datavantagecorp.com Mon Jun 28 14:45:05 2004 From: jozerskiy at datavantagecorp.com (Julia Ozerskiy) Date: Mon Jun 28 14:52:17 2004 Subject: [Tkinter-discuss] unicode in Pmw's addMenu Message-ID: I am tryinig to display unicode characters on Pmw.MainMenuBar. For some reason addmenu() method displays '?' chars where unicode must appear and addmenuitem() method displays correct unicode characters. I am addidng a unicode string. Any hints? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20040628/16aad9fa/attachment.html