From michael.odonnell at uam.es Thu Jun 5 23:19:50 2008 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Thu, 5 Jun 2008 23:19:50 +0200 Subject: [Tkinter-discuss] stipple of rectange in Canvas on Mac Message-ID: <47e491110806051419m28f968b6leffadf67aef178b0@mail.gmail.com> Hi all, I have code to stipple a rectange created in a canvas. The code works on Windows, but under Mac (using Python 2.5.2), no stippling occurs: from Tkinter import * tk = Tk() ac = Canvas(tk, bg="red") ac.pack(side=TOP, expand=YES,fill=BOTH) ac.create_rectangle(10, 10, 200, 200, fill="blue", stipple="gray12") tk.mainloop() Does anyone have any idea if this is a known issue, and if so, are there are ways around the problem? Mick O'Donnell From ggpolo at gmail.com Thu Jun 5 23:35:29 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Thu, 5 Jun 2008 18:35:29 -0300 Subject: [Tkinter-discuss] stipple of rectange in Canvas on Mac In-Reply-To: <47e491110806051419m28f968b6leffadf67aef178b0@mail.gmail.com> References: <47e491110806051419m28f968b6leffadf67aef178b0@mail.gmail.com> Message-ID: 2008/6/5 Michael O'Donnell : > Hi all, > > I have code to stipple a rectange created in a canvas. The code > works on Windows, but under Mac (using Python 2.5.2), no stippling > occurs: > > from Tkinter import * > > tk = Tk() > ac = Canvas(tk, bg="red") > ac.pack(side=TOP, expand=YES,fill=BOTH) > ac.create_rectangle(10, 10, 200, 200, fill="blue", stipple="gray12") > tk.mainloop() > > > Does anyone have any idea if this is a known issue, and if so, are there > are ways around the problem? I don't have a Mac to test it, but I would suggest converting it to Tcl code and then try it again. If it works, then it is a problem in Tkinter (which doesn't seems to be), otherwise it is a problem in Tcl/Tk. Equivalent Tcl code: package require Tk canvas .ac -bg red pack .ac -side top -expand yes -fill both .ac create rectangle 10 10 200 200 -fill blue -stipple gray12 > > Mick O'Donnell > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From kw at codebykevin.com Thu Jun 5 23:43:32 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Thu, 05 Jun 2008 17:43:32 -0400 Subject: [Tkinter-discuss] stipple of rectange in Canvas on Mac In-Reply-To: <47e491110806051419m28f968b6leffadf67aef178b0@mail.gmail.com> References: <47e491110806051419m28f968b6leffadf67aef178b0@mail.gmail.com> Message-ID: <48485E04.6060600@codebykevin.com> Michael O'Donnell wrote: > Hi all, > > I have code to stipple a rectange created in a canvas. The code > works on Windows, but under Mac (using Python 2.5.2), no stippling > occurs: > > from Tkinter import * > > tk = Tk() > ac = Canvas(tk, bg="red") > ac.pack(side=TOP, expand=YES,fill=BOTH) > ac.create_rectangle(10, 10, 200, 200, fill="blue", stipple="gray12") > tk.mainloop() > > > Does anyone have any idea if this is a known issue, and if so, are there > are ways around the problem? > > Mick O'Donnell > _______________________________________________ Stippling isn't supported under Aqua I'm not sure there's a known workaround. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From grflanagan at gmail.com Sat Jun 7 15:48:07 2008 From: grflanagan at gmail.com (Gerard flanagan) Date: Sat, 07 Jun 2008 15:48:07 +0200 Subject: [Tkinter-discuss] [ANN] Ttk wrapper 0.0.9 In-Reply-To: References: Message-ID: Guilherme Polo wrote: > Hello, > > Over the last weeks I've been doing a ttk wrapper as part of my GSoC > project and now I feel that I can announce it in hope some people > start using it. > > > What is Ttk ? > > This wrapper provides classes to allow using the Tk themed widget > set, which has been included in Tk 8.5 but can be used with earlier > versions if you have Tile installed. Ttk is based on a revised and > enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style > engine. > [...] > Also, there is a site with some info regarding this project at: > http://gpolo.ath.cx:81/projects/ttk_to_tkinter/ > > just a suggestion - how about some screenshots? (that was a short summer ;-) Gerard From ggpolo at gmail.com Sat Jun 7 16:30:09 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Sat, 7 Jun 2008 11:30:09 -0300 Subject: [Tkinter-discuss] [ANN] Ttk wrapper 0.0.9 In-Reply-To: References: Message-ID: 2008/6/7 Gerard flanagan : > Guilherme Polo wrote: >> >> Hello, >> >> Over the last weeks I've been doing a ttk wrapper as part of my GSoC >> project and now I feel that I can announce it in hope some people >> start using it. >> >> >> What is Ttk ? >> >> This wrapper provides classes to allow using the Tk themed widget >> set, which has been included in Tk 8.5 but can be used with earlier >> versions if you have Tile installed. Ttk is based on a revised and >> enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style >> engine. >> > [...] >> >> Also, there is a site with some info regarding this project at: >> http://gpolo.ath.cx:81/projects/ttk_to_tkinter/ >> >> > > just a suggestion - how about some screenshots? > Let me see if I can take some good shots ;) I don't have real applications using the widgets, just some small samples. > (that was a short summer ;-) Heh, I have some other tasks to conclude. I'm working on adding some support classes now, so it would be good (and would help me too) if people from the list suggested something. Right now there are just two extension classes, OptionMenu (which Tkinter has too) and LabeledScale to compensate for the huge difference between Tkinter.Scale and ttk.Scale. Thanks, > > Gerard > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From ggpolo at gmail.com Sat Jun 7 23:19:36 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Sat, 7 Jun 2008 18:19:36 -0300 Subject: [Tkinter-discuss] [ANN] Ttk wrapper 0.0.9 In-Reply-To: References: Message-ID: 2008/6/7 Guilherme Polo : > 2008/6/7 Gerard flanagan : >> Guilherme Polo wrote: >>> >>> Hello, >>> >>> Over the last weeks I've been doing a ttk wrapper as part of my GSoC >>> project and now I feel that I can announce it in hope some people >>> start using it. >>> >>> >>> What is Ttk ? >>> >>> This wrapper provides classes to allow using the Tk themed widget >>> set, which has been included in Tk 8.5 but can be used with earlier >>> versions if you have Tile installed. Ttk is based on a revised and >>> enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style >>> engine. >>> >> [...] >>> >>> Also, there is a site with some info regarding this project at: >>> http://gpolo.ath.cx:81/projects/ttk_to_tkinter/ >>> >>> >> >> just a suggestion - how about some screenshots? >> I just created a new project at code.google.com to host it, http://code.google.com/p/python-ttk/ or the direct link for some screenshots: http://code.google.com/p/python-ttk/wiki/Screenshots > > Let me see if I can take some good shots ;) > I don't have real applications using the widgets, just some small samples. > >> (that was a short summer ;-) > > Heh, I have some other tasks to conclude. I'm working on adding some > support classes now, so it would be good (and would help me too) if > people from the list suggested something. Right now there are just two > extension classes, OptionMenu (which Tkinter has too) and LabeledScale > to compensate for the huge difference between Tkinter.Scale and > ttk.Scale. > > Thanks, > >> >> Gerard >> >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> > > > > -- > -- Guilherme H. Polo Goncalves > -- -- Guilherme H. Polo Goncalves From grflanagan at gmail.com Sun Jun 8 09:00:09 2008 From: grflanagan at gmail.com (Gerard flanagan) Date: Sun, 08 Jun 2008 09:00:09 +0200 Subject: [Tkinter-discuss] [ANN] Ttk wrapper 0.0.9 In-Reply-To: References: Message-ID: Guilherme Polo wrote: > 2008/6/7 Guilherme Polo : >> 2008/6/7 Gerard flanagan : >>> Guilherme Polo wrote: >>>> Hello, >>>> >>>> Over the last weeks I've been doing a ttk wrapper as part of my GSoC >>>> project and now I feel that I can announce it in hope some people >>>> start using it. >>>> >>>> >>>> What is Ttk ? >>>> >>>> This wrapper provides classes to allow using the Tk themed widget >>>> set, which has been included in Tk 8.5 but can be used with earlier >>>> versions if you have Tile installed. Ttk is based on a revised and >>>> enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style >>>> engine. >>>> >>> [...] >>>> Also, there is a site with some info regarding this project at: >>>> http://gpolo.ath.cx:81/projects/ttk_to_tkinter/ >>>> >>>> >>> just a suggestion - how about some screenshots? >>> > > I just created a new project at code.google.com to host it, > http://code.google.com/p/python-ttk/ or the direct link for some > screenshots: http://code.google.com/p/python-ttk/wiki/Screenshots > Looks good, thanks. But, a problem: The only experience I have with Tkinter is via easygui http://www.ferg.org/easygui (which has its limitations, but i've found it invaluable for creating simple 'wizard' style interfaces for various configuration tasks.) So, (on xubuntu Hardy) I did: apt-get tk-tile svn co http://svn.python.org/projects/sandbox/trunk/ttk-gsoc ttk-trunk updated PYTHONPATH no problem with `import ttk` as per the docs, edited easygui.py to include `from ttk import *` below the line `from Tkinter import *` but app fails immediately with the following traceback File "lib/_h2hdeploygui.py", line 374, in main choice = choicebox(MAIN_MSG, MAIN_MSG, MAIN.keys()) File "lib/itsalib/util/easygui.py", line 611, in choicebox return __choicebox(message, title, choices) File "lib/itsalib/util/easygui.py", line 745, in __choicebox okButton = Button(buttonsFrame, takefocus=YES, text="OK", height=1, width=6) File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 559, in __init__ Widget.__init__(self, master, "ttk::button", kw) File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 505, in __init__ Tkinter.Widget.__init__(self, master, widgetname, kw=kw) File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1933, in __init__ (widgetName, self._w) + extra + self._options(cnf)) TclError: unknown option "-height" I noticed that there was a more recent easygui.py (73), but the same result - app works without the ttk import, doesn't work with. Fixable? Gerard >> Let me see if I can take some good shots ;) >> I don't have real applications using the widgets, just some small samples. >> >>> (that was a short summer ;-) >> Heh, I have some other tasks to conclude. I'm working on adding some >> support classes now, so it would be good (and would help me too) if >> people from the list suggested something. Right now there are just two >> extension classes, OptionMenu (which Tkinter has too) and LabeledScale >> to compensate for the huge difference between Tkinter.Scale and >> ttk.Scale. >> >> Thanks, >> >>> Gerard >>> >>> >>> _______________________________________________ >>> Tkinter-discuss mailing list >>> Tkinter-discuss at python.org >>> http://mail.python.org/mailman/listinfo/tkinter-discuss >>> >> >> >> -- >> -- Guilherme H. Polo Goncalves >> > > > From ggpolo at gmail.com Sun Jun 8 14:13:05 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Sun, 8 Jun 2008 09:13:05 -0300 Subject: [Tkinter-discuss] [ANN] Ttk wrapper 0.0.9 In-Reply-To: References: Message-ID: 2008/6/8 Gerard flanagan : > Guilherme Polo wrote: >> >> 2008/6/7 Guilherme Polo : >>> >>> 2008/6/7 Gerard flanagan : >>>> >>>> Guilherme Polo wrote: >>>>> >>>>> Hello, >>>>> >>>>> Over the last weeks I've been doing a ttk wrapper as part of my GSoC >>>>> project and now I feel that I can announce it in hope some people >>>>> start using it. >>>>> >>>>> >>>>> What is Ttk ? >>>>> >>>>> This wrapper provides classes to allow using the Tk themed widget >>>>> set, which has been included in Tk 8.5 but can be used with earlier >>>>> versions if you have Tile installed. Ttk is based on a revised and >>>>> enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style >>>>> engine. >>>>> >>>> [...] >>>>> >>>>> Also, there is a site with some info regarding this project at: >>>>> http://gpolo.ath.cx:81/projects/ttk_to_tkinter/ >>>>> >>>>> >>>> just a suggestion - how about some screenshots? >>>> >> >> I just created a new project at code.google.com to host it, >> http://code.google.com/p/python-ttk/ or the direct link for some >> screenshots: http://code.google.com/p/python-ttk/wiki/Screenshots >> > > Looks good, thanks. > > But, a problem: > > The only experience I have with Tkinter is via easygui > > http://www.ferg.org/easygui > > (which has its limitations, but i've found it invaluable for creating simple > 'wizard' style interfaces for various configuration tasks.) > > So, (on xubuntu Hardy) I did: > > apt-get tk-tile > svn co http://svn.python.org/projects/sandbox/trunk/ttk-gsoc ttk-trunk > updated PYTHONPATH > no problem with `import ttk` > as per the docs, edited easygui.py to include `from ttk import *` > below the line `from Tkinter import *` > but app fails immediately with the following traceback > > File "lib/_h2hdeploygui.py", line 374, in main > choice = choicebox(MAIN_MSG, MAIN_MSG, MAIN.keys()) > File "lib/itsalib/util/easygui.py", line 611, in choicebox > return __choicebox(message, title, choices) > File "lib/itsalib/util/easygui.py", line 745, in __choicebox > okButton = Button(buttonsFrame, takefocus=YES, text="OK", height=1, > width=6) > File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 559, in __init__ > Widget.__init__(self, master, "ttk::button", kw) > File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 505, in __init__ > Tkinter.Widget.__init__(self, master, widgetname, kw=kw) > File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1933, in __init__ > (widgetName, self._w) + extra + self._options(cnf)) > TclError: unknown option "-height" > > I noticed that there was a more recent easygui.py (73), but the same > result - app works without the ttk import, doesn't work with. > Doing "from ttk import *" is not always a drop-in replacement for Tkinter, you will usually have to adjust your app. > Fixable? In this case it was an easy fix, just commented out some parts. I'm attaching the patch against easygui73, hope it works for you. This patch is supposed to be applied at a clean, just unzipped, easygui.py (version 73). Regards, -- -- Guilherme H. Polo Goncalves -------------- next part -------------- A non-text attachment was scrubbed... Name: easygui_ttk.diff Type: text/x-diff Size: 2381 bytes Desc: not available URL: From grflanagan at gmail.com Sun Jun 8 18:24:26 2008 From: grflanagan at gmail.com (Gerard flanagan) Date: Sun, 08 Jun 2008 18:24:26 +0200 Subject: [Tkinter-discuss] [ANN] Ttk wrapper 0.0.9 In-Reply-To: References: Message-ID: Guilherme Polo wrote: > 2008/6/8 Gerard flanagan : >> Guilherme Polo wrote: >>> 2008/6/7 Guilherme Polo : >>>> 2008/6/7 Gerard flanagan : >>>>> Guilherme Polo wrote: >>>>>> Hello, >>>>>> >>>>>> Over the last weeks I've been doing a ttk wrapper as part of my GSoC >>>>>> project and now I feel that I can announce it in hope some people >>>>>> start using it. >>>>>> >>>>>> >>>>>> What is Ttk ? >>>>>> >>>>>> This wrapper provides classes to allow using the Tk themed widget >>>>>> set, which has been included in Tk 8.5 but can be used with earlier >>>>>> versions if you have Tile installed. Ttk is based on a revised and >>>>>> enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style >>>>>> engine. >>>>>> >>>>> [...] >>>>>> Also, there is a site with some info regarding this project at: >>>>>> http://gpolo.ath.cx:81/projects/ttk_to_tkinter/ >>>>>> >>>>>> >>>>> just a suggestion - how about some screenshots? >>>>> >>> I just created a new project at code.google.com to host it, >>> http://code.google.com/p/python-ttk/ or the direct link for some >>> screenshots: http://code.google.com/p/python-ttk/wiki/Screenshots >>> >> Looks good, thanks. >> >> But, a problem: >> >> The only experience I have with Tkinter is via easygui >> >> http://www.ferg.org/easygui >> >> (which has its limitations, but i've found it invaluable for creating simple >> 'wizard' style interfaces for various configuration tasks.) >> >> So, (on xubuntu Hardy) I did: >> >> apt-get tk-tile >> svn co http://svn.python.org/projects/sandbox/trunk/ttk-gsoc ttk-trunk >> updated PYTHONPATH >> no problem with `import ttk` >> as per the docs, edited easygui.py to include `from ttk import *` >> below the line `from Tkinter import *` >> but app fails immediately with the following traceback >> >> File "lib/_h2hdeploygui.py", line 374, in main >> choice = choicebox(MAIN_MSG, MAIN_MSG, MAIN.keys()) >> File "lib/itsalib/util/easygui.py", line 611, in choicebox >> return __choicebox(message, title, choices) >> File "lib/itsalib/util/easygui.py", line 745, in __choicebox >> okButton = Button(buttonsFrame, takefocus=YES, text="OK", height=1, >> width=6) >> File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 559, in __init__ >> Widget.__init__(self, master, "ttk::button", kw) >> File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 505, in __init__ >> Tkinter.Widget.__init__(self, master, widgetname, kw=kw) >> File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1933, in __init__ >> (widgetName, self._w) + extra + self._options(cnf)) >> TclError: unknown option "-height" >> >> I noticed that there was a more recent easygui.py (73), but the same >> result - app works without the ttk import, doesn't work with. >> > > Doing "from ttk import *" is not always a drop-in replacement for > Tkinter, you will usually have to adjust your app. > Ah, I see I should have read more of the docs. >> Fixable? > > In this case it was an easy fix, just commented out some parts. I'm > attaching the patch against easygui73, hope it works for you. This > patch is supposed to be applied at a clean, just unzipped, easygui.py > (version 73). > yes, that did it. Thanks for that. Good luck with the rest of your project. Regards Gerard From alexnbryan at gmail.com Tue Jun 10 06:59:23 2008 From: alexnbryan at gmail.com (Alexnb) Date: Mon, 9 Jun 2008 21:59:23 -0700 (PDT) Subject: [Tkinter-discuss] how to hit enter and get the Entry() text Message-ID: <17747813.post@talk.nabble.com> Okay, so I am new to Tkinter, and can't figure out how to get the text out of my Entry() text box. I know I can make a button or something like that where they click it and I get it. But what I want to do is have the user typing in the box, and then they hit "return" or "enter" and that also gets it for example: [code] e = Entry(root, width=25) e.pack() Button1 = Button(root, command=get) Button1.pack() def get(): print e.get() [/code] Something like that, only I want to eliminate the button, and make it to where the user hits enter in the text box and it does the get() function. Help? -- View this message in context: http://www.nabble.com/how-to-hit-enter-and-get-the-Entry%28%29-text-tp17747813p17747813.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Tue Jun 10 15:21:06 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Tue, 10 Jun 2008 10:21:06 -0300 Subject: [Tkinter-discuss] how to hit enter and get the Entry() text In-Reply-To: <17747813.post@talk.nabble.com> References: <17747813.post@talk.nabble.com> Message-ID: On Tue, Jun 10, 2008 at 1:59 AM, Alexnb wrote: > > Okay, so I am new to Tkinter, and can't figure out how to get the text out of > my Entry() text box. I know I can make a button or something like that where > they click it and I get it. But what I want to do is have the user typing in > the box, and then they hit "return" or "enter" and that also gets it for > example: > You have to bind to your entry widget. > [code] > > e = Entry(root, width=25) > e.pack() > > Button1 = Button(root, command=get) > Button1.pack() > > def get(): > print e.get() > > [/code] > I'm sure you have defined this function "get" before that point since that code would fail. > Something like that, only I want to eliminate the button, and make it to > where the user hits enter in the text box and it does the get() function. > Help? def get(event): print event.widget.get() e = Entry(root, width=25) e.bind('', get) e.pack() > -- > View this message in context: http://www.nabble.com/how-to-hit-enter-and-get-the-Entry%28%29-text-tp17747813p17747813.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From alexnbryan at gmail.com Tue Jun 10 17:19:11 2008 From: alexnbryan at gmail.com (Alexnb) Date: Tue, 10 Jun 2008 08:19:11 -0700 (PDT) Subject: [Tkinter-discuss] how to hit enter and get the Entry() text In-Reply-To: References: <17747813.post@talk.nabble.com> Message-ID: <17757997.post@talk.nabble.com> Guilherme Polo wrote: > > On Tue, Jun 10, 2008 at 1:59 AM, Alexnb wrote: >> >> Okay, so I am new to Tkinter, and can't figure out how to get the text >> out of >> my Entry() text box. I know I can make a button or something like that >> where >> they click it and I get it. But what I want to do is have the user typing >> in >> the box, and then they hit "return" or "enter" and that also gets it for >> example: >> > > You have to bind to your entry widget. > >> [code] >> >> e = Entry(root, width=25) >> e.pack() >> >> Button1 = Button(root, command=get) >> Button1.pack() >> >> def get(): >> print e.get() >> >> [/code] >> > > I'm sure you have defined this function "get" before that point since > that code would fail. > >> Something like that, only I want to eliminate the button, and make it to >> where the user hits enter in the text box and it does the get() function. >> Help? > > def get(event): > print event.widget.get() > > e = Entry(root, width=25) > e.bind('', get) > e.pack() > >> -- >> View this message in context: >> http://www.nabble.com/how-to-hit-enter-and-get-the-Entry%28%29-text-tp17747813p17747813.html >> Sent from the Python - tkinter-discuss mailing list archive at >> Nabble.com. >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> > > > > -- > -- Guilherme H. Polo Goncalves > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > It worked, but I thought I already tried that.. I guess I had done it wrong or something. Thanks alot! -- View this message in context: http://www.nabble.com/how-to-hit-enter-and-get-the-Entry%28%29-text-tp17747813p17757997.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From bob at passcal.nmt.edu Tue Jun 10 17:17:21 2008 From: bob at passcal.nmt.edu (Bob Greschke) Date: Tue, 10 Jun 2008 09:17:21 -0600 Subject: [Tkinter-discuss] how to hit enter and get the Entry() text In-Reply-To: References: <17747813.post@talk.nabble.com> Message-ID: <2409C705-D193-4651-8177-7AEB7CCDF7B3@passcal.nmt.edu> And for it to respond to the keypad Enter/Return key. On Jun 10, 2008, at 07:21, Guilherme Polo wrote: > On Tue, Jun 10, 2008 at 1:59 AM, Alexnb wrote: >> >> Okay, so I am new to Tkinter, and can't figure out how to get the >> text out of >> my Entry() text box. I know I can make a button or something like >> that where >> they click it and I get it. But what I want to do is have the user >> typing in >> the box, and then they hit "return" or "enter" and that also gets >> it for >> example: >> > > You have to bind to your entry widget. From jedens at cabinc.com Wed Jun 11 21:52:21 2008 From: jedens at cabinc.com (John Edens) Date: Wed, 11 Jun 2008 14:52:21 -0500 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? Message-ID: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> Hi all, I've just started working with Python and Tkinter. One of the things I think I've noted is that Button commands do not pass parameters. Is there a way around this? And is there a better way to code the following: I've written a small application that puts a Label in row 0 of a Frame and puts 26 buttons labeled A - Z in the second row. When the user clicks on a button, the associated letter is displayed in the label. Code follows: # Creates a label in row 0 # Creates 26 buttons A - Z in row 2 # Clicking a button changes the displayed label from Tkinter import * class Application(Frame): def __init__(self,master=None): Frame.__init__(self, master) self.grid() self.tv = StringVar() self.tv.set("?") self.lText = Label(master, textvariable = self.tv) self.lText.grid(row = 0, columnspan = 26) butA = Button(master, text= 'A', command = self.choseA).grid(row = 2, column = 0 ) butB = Button(master, text= 'B', command = self.choseB).grid(row = 2, column = 1 ) butC = Button(master, text= 'C', command = self.choseC).grid(row = 2, column = 2 ) butD = Button(master, text= 'D', command = self.choseD).grid(row = 2, column = 3 ) butE = Button(master, text= 'E', command = self.choseE).grid(row = 2, column = 4 ) butF = Button(master, text= 'F', command = self.choseF).grid(row = 2, column = 5 ) butG = Button(master, text= 'G', command = self.choseG).grid(row = 2, column = 6 ) butH = Button(master, text= 'H', command = self.choseH).grid(row = 2, column = 7 ) butI = Button(master, text= 'I', command = self.choseI).grid(row = 2, column = 8 ) butJ = Button(master, text= 'J', command = self.choseJ).grid(row = 2, column = 9 ) butK = Button(master, text= 'K', command = self.choseK).grid(row = 2, column = 10 ) butL = Button(master, text= 'L', command = self.choseL).grid(row = 2, column = 11 ) butM = Button(master, text= 'M', command = self.choseM).grid(row = 2, column = 12 ) butN = Button(master, text= 'N', command = self.choseN).grid(row = 2, column = 13 ) butO = Button(master, text= 'O', command = self.choseO).grid(row = 2, column = 14 ) butP = Button(master, text= 'P', command = self.choseP).grid(row = 2, column = 15 ) butQ = Button(master, text= 'Q', command = self.choseQ).grid(row = 2, column = 16 ) butR = Button(master, text= 'R', command = self.choseR).grid(row = 2, column = 17 ) butS = Button(master, text= 'S', command = self.choseS).grid(row = 2, column = 18 ) butT = Button(master, text= 'T', command = self.choseT).grid(row = 2, column = 19 ) butU = Button(master, text= 'U', command = self.choseU).grid(row = 2, column = 20 ) butV = Button(master, text= 'V', command = self.choseV).grid(row = 2, column = 21 ) butW = Button(master, text= 'W', command = self.choseW).grid(row = 2, column = 22 ) butX = Button(master, text= 'X', command = self.choseX).grid(row = 2, column = 23 ) butY = Button(master, text= 'Y', command = self.choseY).grid(row = 2, column = 24 ) butZ = Button(master, text= 'Z', command = self.choseZ).grid(row = 2, column = 25 ) def choseA(self): self.resolveChoice( 65 ) def choseB(self): self.resolveChoice( 66 ) def choseC(self): self.resolveChoice( 67 ) def choseD(self): self.resolveChoice( 68 ) def choseE(self): self.resolveChoice( 69 ) def choseF(self): self.resolveChoice( 70 ) def choseG(self): self.resolveChoice( 71 ) def choseH(self): self.resolveChoice( 72 ) def choseI(self): self.resolveChoice( 73 ) def choseJ(self): self.resolveChoice( 74 ) def choseK(self): self.resolveChoice( 75 ) def choseL(self): self.resolveChoice( 76 ) def choseM(self): self.resolveChoice( 77 ) def choseN(self): self.resolveChoice( 78 ) def choseO(self): self.resolveChoice( 79 ) def choseP(self): self.resolveChoice( 80 ) def choseQ(self): self.resolveChoice( 81 ) def choseR(self): self.resolveChoice( 82 ) def choseS(self): self.resolveChoice( 83 ) def choseT(self): self.resolveChoice( 84 ) def choseU(self): self.resolveChoice( 85 ) def choseV(self): self.resolveChoice( 86 ) def choseW(self): self.resolveChoice( 87 ) def choseX(self): self.resolveChoice( 88 ) def choseY(self): self.resolveChoice( 89 ) def choseZ(self): self.resolveChoice( 90 ) def resolveChoice(self,asciiVal): self.tv.set(chr(asciiVal)) root = Tk() app = Application(root) root.mainloop() -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmcmonagle at velseis.com.au Thu Jun 12 07:48:32 2008 From: jmcmonagle at velseis.com.au (John McMonagle) Date: Thu, 12 Jun 2008 15:48:32 +1000 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> Message-ID: <4850B8B0.90300@velseis.com.au> John Edens wrote: > Hi all, I?ve just started working with Python and Tkinter. > > > > One of the things I think I?ve noted is that Button commands do not pass > parameters. > > > > Is there a way around this? The short answer is... use a lambda or a named function. > > > > And is there a better way to code the following: > > > > I?ve written a small application that puts a Label in row 0 of a Frame > and puts 26 buttons labeled A ? Z in the second row. > > > > When the user clicks on a button, the associated letter is displayed in > the label. > > > Simplified.... # Creates a label in row 0 # Creates 26 buttons A - Z in row 2 # Clicking a button changes the displayed label from Tkinter import * import string class Application(Frame): def __init__(self,master=None): Frame.__init__(self, master) self.grid() self.tv = StringVar() self.tv.set("?") self.lText = Label(master, textvariable = self.tv) self.lText.grid(row = 0, columnspan = 26) col = 0 for letter in string.uppercase: Button(master, text=letter, command=lambda input=letter: self.tv.set(input)).grid(row=2, column=col) col += 1 root = Tk() app = Application(root) root.mainloop() Regards, John From jmcmonagle at velseis.com.au Thu Jun 12 08:33:13 2008 From: jmcmonagle at velseis.com.au (John McMonagle) Date: Thu, 12 Jun 2008 16:33:13 +1000 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> Message-ID: <4850C329.2090504@velseis.com.au> John Edens wrote: > Hi all, I?ve just started working with Python and Tkinter. > > > > One of the things I think I?ve noted is that Button commands do not pass > parameters. > > > > Is there a way around this? The short answer is... use a lambda or a named function. > > > > And is there a better way to code the following: > > > > I?ve written a small application that puts a Label in row 0 of a Frame > and puts 26 buttons labeled A ? Z in the second row. > > > > When the user clicks on a button, the associated letter is displayed in > the label. > > > Simplified.... # Creates a label in row 0 # Creates 26 buttons A - Z in row 2 # Clicking a button changes the displayed label from Tkinter import * import string class Application(Frame): def __init__(self,master=None): Frame.__init__(self, master) self.grid() self.tv = StringVar() self.tv.set("?") self.lText = Label(master, textvariable = self.tv) self.lText.grid(row = 0, columnspan = 26) col = 0 for letter in string.uppercase: Button(master, text=letter, command=lambda input=letter: self.tv.set(input)).grid(row=2, column=col) col += 1 root = Tk() app = Application(root) root.mainloop() Regards, John From bob at passcal.nmt.edu Thu Jun 12 18:51:37 2008 From: bob at passcal.nmt.edu (Bob Greschke) Date: Thu, 12 Jun 2008 10:51:37 -0600 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> Message-ID: <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> On Jun 11, 2008, at 13:52, John Edens wrote: > Hi all, I?ve just started working with Python and Tkinter. > > One of the things I think I?ve noted is that Button commands do not > pass parameters. > > Is there a way around this? > > And is there a better way to code the following: > > I?ve written a small application that puts a Label in row 0 of a > Frame and puts 26 buttons labeled A ? Z in the second row. > > When the user clicks on a button, the associated letter is displayed > in the label. > I use (stolen from several places in Python history): ###################### # BEGIN: class Command # LIB:Command():2006.110 # Pass arguments to functions from button presses and menu selections! Nice! # In your declaration: ...command = Command(func, args,...) # Also use in bind() statements # x.bind("<****>", Command(func, args...)) class Command: def __init__(self, func, *args, **kw): self.func = func self.args = args self.kw = kw def __call__(self, *args, **kw): args = self.args+args kw.update(self.kw) apply(self.func, args, kw) # END: class Command then for a button you would do Button(Frame, text = "BLAH B", command = Command(doBlah, "B")).pack(side = LEFT) Button(Frame, text = "BLAH C", command = Command(doBlah, "C")).pack(side = LEFT) . . . Bob From jedens at cabinc.com Thu Jun 12 19:56:41 2008 From: jedens at cabinc.com (John Edens) Date: Thu, 12 Jun 2008 12:56:41 -0500 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> Message-ID: <6CBBAEC1C23C414FB5D64484D8366A490503C2BF8D@texmail.cabinc.com> That is exactly what I was looking for - seems like something that should go into the wiki! -----Original Message----- From: Bob Greschke [mailto:bob at passcal.nmt.edu] Sent: Thursday, June 12, 2008 11:52 AM To: John Edens Cc: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? On Jun 11, 2008, at 13:52, John Edens wrote: > Hi all, I've just started working with Python and Tkinter. > > One of the things I think I've noted is that Button commands do not > pass parameters. > > Is there a way around this? > > And is there a better way to code the following: > > I've written a small application that puts a Label in row 0 of a > Frame and puts 26 buttons labeled A - Z in the second row. > > When the user clicks on a button, the associated letter is displayed > in the label. > I use (stolen from several places in Python history): ###################### # BEGIN: class Command # LIB:Command():2006.110 # Pass arguments to functions from button presses and menu selections! Nice! # In your declaration: ...command = Command(func, args,...) # Also use in bind() statements # x.bind("<****>", Command(func, args...)) class Command: def __init__(self, func, *args, **kw): self.func = func self.args = args self.kw = kw def __call__(self, *args, **kw): args = self.args+args kw.update(self.kw) apply(self.func, args, kw) # END: class Command then for a button you would do Button(Frame, text = "BLAH B", command = Command(doBlah, "B")).pack(side = LEFT) Button(Frame, text = "BLAH C", command = Command(doBlah, "C")).pack(side = LEFT) . . . Bob From alexnbryan at gmail.com Thu Jun 12 20:16:32 2008 From: alexnbryan at gmail.com (Alexnb) Date: Thu, 12 Jun 2008 11:16:32 -0700 (PDT) Subject: [Tkinter-discuss] Easy way to get a file explorer? Message-ID: <17806393.post@talk.nabble.com> Okay, so in the small app I am creating I want to have a button that activates a file explorer and then once the user selects a file I want to be able to get the path of that file. Is there a way to do this without going into serious detail? and if not could someone point me in the right direction? I am open to about anything. Thanks. -- View this message in context: http://www.nabble.com/Easy-way-to-get-a-file-explorer--tp17806393p17806393.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Thu Jun 12 20:22:40 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Thu, 12 Jun 2008 15:22:40 -0300 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> Message-ID: On Thu, Jun 12, 2008 at 1:51 PM, Bob Greschke wrote: > > On Jun 11, 2008, at 13:52, John Edens wrote: > >> Hi all, I've just started working with Python and Tkinter. >> >> One of the things I think I've noted is that Button commands do not pass >> parameters. >> >> Is there a way around this? >> >> And is there a better way to code the following: >> >> I've written a small application that puts a Label in row 0 of a Frame and >> puts 26 buttons labeled A ? Z in the second row. >> >> When the user clicks on a button, the associated letter is displayed in >> the label. >> > > I use (stolen from several places in Python history): > > ###################### > # BEGIN: class Command > # LIB:Command():2006.110 > # Pass arguments to functions from button presses and menu selections! Nice! > # In your declaration: ...command = Command(func, args,...) > # Also use in bind() statements > # x.bind("<****>", Command(func, args...)) > class Command: > def __init__(self, func, *args, **kw): > self.func = func > self.args = args > self.kw = kw > def __call__(self, *args, **kw): > args = self.args+args > kw.update(self.kw) > apply(self.func, args, kw) > # END: class Command > You don't need all that machinery tho, something simpler like: def command(func, *args, **kw): def _wrapper(*wargs): return func(*(wargs + args), **kw) return _wrapper would work too. But considering that code is using "apply", I will take it as really old and outdated by now. > then for a button you would do > > Button(Frame, text = "BLAH B", command = Command(doBlah, "B")).pack(side = > LEFT) > Button(Frame, text = "BLAH C", command = Command(doBlah, "C")).pack(side = > LEFT) > . > . > . > > Bob > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From kw at codebykevin.com Thu Jun 12 20:24:00 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Thu, 12 Jun 2008 14:24:00 -0400 Subject: [Tkinter-discuss] Easy way to get a file explorer? In-Reply-To: <17806393.post@talk.nabble.com> References: <17806393.post@talk.nabble.com> Message-ID: <485169C0.10104@codebykevin.com> Alexnb wrote: > Okay, so in the small app I am creating I want to have a button that > activates a file explorer and then once the user selects a file I want to be > able to get the path of that file. Is there a way to do this without going > into serious detail? and if not could someone point me in the right > direction? I am open to about anything. Thanks. tkFileDialog is what you're looking for. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From alexnbryan at gmail.com Thu Jun 12 21:36:33 2008 From: alexnbryan at gmail.com (Alexnb) Date: Thu, 12 Jun 2008 12:36:33 -0700 (PDT) Subject: [Tkinter-discuss] Easy way to get a file explorer? In-Reply-To: <485169C0.10104@codebykevin.com> References: <17806393.post@talk.nabble.com> <485169C0.10104@codebykevin.com> Message-ID: <17808068.post@talk.nabble.com> Thanks, this is exactly what I am looking for, but I can't find much useful documentation on it. So I want to have it give me a string of the path of the file they selected, which seems simple, but I am having issues. for example: path = tkFileDialog.askopenfile() print path it prints this: but all I want is the actual path. So how can I do that? Kevin Walzer-5 wrote: > > Alexnb wrote: >> Okay, so in the small app I am creating I want to have a button that >> activates a file explorer and then once the user selects a file I want to >> be >> able to get the path of that file. Is there a way to do this without >> going >> into serious detail? and if not could someone point me in the right >> direction? I am open to about anything. Thanks. > > tkFileDialog is what you're looking for. > > -- > Kevin Walzer > Code by Kevin > http://www.codebykevin.com > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://www.nabble.com/Easy-way-to-get-a-file-explorer--tp17806393p17808068.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Thu Jun 12 21:45:21 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Thu, 12 Jun 2008 16:45:21 -0300 Subject: [Tkinter-discuss] Easy way to get a file explorer? In-Reply-To: <17808068.post@talk.nabble.com> References: <17806393.post@talk.nabble.com> <485169C0.10104@codebykevin.com> <17808068.post@talk.nabble.com> Message-ID: On Thu, Jun 12, 2008 at 4:36 PM, Alexnb wrote: > > Thanks, this is exactly what I am looking for, but I can't find much useful > documentation on it. So I want to have it give me a string of the path of > the file they selected, which seems simple, but I am having issues. for > example: > > path = tkFileDialog.askopenfile() > print path > > it prints this: > > Music/101-u2-instant_karma.mp3', mode 'r' at 0x00C3EE78> > > but all I want is the actual path. So how can I do that? > use askopenfilename instead. > Kevin Walzer-5 wrote: >> >> Alexnb wrote: >>> Okay, so in the small app I am creating I want to have a button that >>> activates a file explorer and then once the user selects a file I want to >>> be >>> able to get the path of that file. Is there a way to do this without >>> going >>> into serious detail? and if not could someone point me in the right >>> direction? I am open to about anything. Thanks. >> >> tkFileDialog is what you're looking for. >> >> -- >> Kevin Walzer >> Code by Kevin >> http://www.codebykevin.com >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > > -- > View this message in context: http://www.nabble.com/Easy-way-to-get-a-file-explorer--tp17806393p17808068.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From Cameron at phaseit.net Fri Jun 13 20:29:52 2008 From: Cameron at phaseit.net (Cameron Laird) Date: Fri, 13 Jun 2008 18:29:52 +0000 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <6CBBAEC1C23C414FB5D64484D8366A490503C2BF8D@texmail.cabinc.com> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> <6CBBAEC1C23C414FB5D64484D8366A490503C2BF8D@texmail.cabinc.com> Message-ID: <20080613182952.GB14282@lairds.us> On Thu, Jun 12, 2008 at 12:56:41PM -0500, John Edens wrote: . . . > That is exactly what I was looking for - seems like something that should go into the wiki! . . . Folks, the Wiki is there to be used--both read from and written to. While I frequently make a point of adding to it, there are more times these days when I just don't get around to it. From jedens at cabinc.com Fri Jun 13 21:06:55 2008 From: jedens at cabinc.com (John Edens) Date: Fri, 13 Jun 2008 14:06:55 -0500 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <20080613182952.GB14282@lairds.us> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> <6CBBAEC1C23C414FB5D64484D8366A490503C2BF8D@texmail.cabinc.com> <20080613182952.GB14282@lairds.us> Message-ID: <6CBBAEC1C23C414FB5D64484D8366A490503C2C0FD@texmail.cabinc.com> Well since I'm a total noob at this, I didn't feel competent to modify the wiki entry for Button, but given your encouragement to do so, I took a crack at it. Anyone who knows the language and terminology better should feel free to edit my entry! -----Original Message----- From: Cameron Laird [mailto:Cameron at phaseit.net] Sent: Friday, June 13, 2008 1:30 PM To: John Edens Cc: 'Bob Greschke'; 'tkinter-discuss at python.org' Subject: Re: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? On Thu, Jun 12, 2008 at 12:56:41PM -0500, John Edens wrote: . . . > That is exactly what I was looking for - seems like something that should go into the wiki! . . . Folks, the Wiki is there to be used--both read from and written to. While I frequently make a point of adding to it, there are more times these days when I just don't get around to it. From alexnbryan at gmail.com Fri Jun 13 22:27:27 2008 From: alexnbryan at gmail.com (Alexnb) Date: Fri, 13 Jun 2008 13:27:27 -0700 (PDT) Subject: [Tkinter-discuss] displaying images with Label() Message-ID: <17831398.post@talk.nabble.com> I have looked online for examples and documentation but can't find anything. Not to say that there isn't but I can't find it. Anyway I am wondering how you display images using the Label() function. I tried something like this but it didn't work Label(parent, image="/path/path/image.png") can someone show me an example or point me in the right direction? I would really appreciate it. -- View this message in context: http://www.nabble.com/displaying-images-with-Label%28%29-tp17831398p17831398.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Fri Jun 13 22:39:02 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Fri, 13 Jun 2008 17:39:02 -0300 Subject: [Tkinter-discuss] displaying images with Label() In-Reply-To: <17831398.post@talk.nabble.com> References: <17831398.post@talk.nabble.com> Message-ID: On Fri, Jun 13, 2008 at 5:27 PM, Alexnb wrote: > > I have looked online for examples and documentation but can't find anything. > Not to say that there isn't but I can't find it. Anyway I am wondering how > you display images using the Label() function. I tried something like this > but it didn't work > > Label(parent, image="/path/path/image.png") > > can someone show me an example or point me in the right direction? I would > really appreciate it. You have to specify compound="left", to specify that the image will be placed at left, and then bitmap=image. This image has to be created earlier, using (probably) the PhotoImage class. > -- > View this message in context: http://www.nabble.com/displaying-images-with-Label%28%29-tp17831398p17831398.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From ggpolo at gmail.com Sat Jun 14 03:54:03 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Fri, 13 Jun 2008 22:54:03 -0300 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: <6CBBAEC1C23C414FB5D64484D8366A490503C2C0FD@texmail.cabinc.com> References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> <6CBBAEC1C23C414FB5D64484D8366A490503C2BF8D@texmail.cabinc.com> <20080613182952.GB14282@lairds.us> <6CBBAEC1C23C414FB5D64484D8366A490503C2C0FD@texmail.cabinc.com> Message-ID: On Fri, Jun 13, 2008 at 4:06 PM, John Edens wrote: > Well since I'm a total noob at this, I didn't feel competent to modify the wiki entry for Button, but given your encouragement to do so, I took a crack at it. Hey John, I think it would be better to place it at a more generic place, not under Button. Other widgets may benefit it too. > > Anyone who knows the language and terminology better should feel free to edit my entry! > > -----Original Message----- > From: Cameron Laird [mailto:Cameron at phaseit.net] > Sent: Friday, June 13, 2008 1:30 PM > To: John Edens > Cc: 'Bob Greschke'; 'tkinter-discuss at python.org' > Subject: Re: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? > > On Thu, Jun 12, 2008 at 12:56:41PM -0500, John Edens wrote: > . > . > . >> That is exactly what I was looking for - seems like something that should go into the wiki! > . > . > . > Folks, the Wiki is there to be used--both read from > and written to. While I frequently make a point of > adding to it, there are more times these days when > I just don't get around to it. > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From c.j.maddison at gmail.com Mon Jun 16 20:21:30 2008 From: c.j.maddison at gmail.com (Chris Maddison) Date: Mon, 16 Jun 2008 14:21:30 -0400 Subject: [Tkinter-discuss] tkSnack Message-ID: <6881E783-47C0-4259-BDAC-60AEB8514A7F@gmail.com> Greetings, I'm new to the list. I'm a second year comp sci student putting together a small simple media library in Python for first year computer science students. I'd like to do sound, and as far as I can tell tkSnack is one of the simplest ways of doing that. Yet, with the lastest version I get the following error (I'm running this on Mac OS 10.5.3): >>> import tkSnack >>> from Tkinter import * >>> root = Tk() >>> tkSnack.initializeSnack(root) Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/tkSnack.py", line 21, in initializeSnack Tkroot.tk.call('eval', 'package require snack') _tkinter.TclError: couldn't load file "/Library/Tcl/snack2.2/ libsnack.dylib": dlopen(/Library/Tcl/snack2.2/libsnack.dylib, 10): no suitable image found. Did find: /Library/Tcl/snack2.2/libsnack.dylib: mach-o, but wrong architecture Has anyone seen this? Any known fixes? Thanks! Christopher Maddison From kw at codebykevin.com Mon Jun 16 20:27:12 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 16 Jun 2008 14:27:12 -0400 Subject: [Tkinter-discuss] tkSnack In-Reply-To: <6881E783-47C0-4259-BDAC-60AEB8514A7F@gmail.com> References: <6881E783-47C0-4259-BDAC-60AEB8514A7F@gmail.com> Message-ID: <4856B080.6050703@codebykevin.com> Chris Maddison wrote: > Greetings, > > I'm new to the list. I'm a second year comp sci student putting together > a small simple media library in Python for first year computer science > students. I'd like to do sound, and as far as I can tell tkSnack is one > of the simplest ways of doing that. Yet, with the lastest version I get > the following error (I'm running this on Mac OS 10.5.3): > > >>> import tkSnack > >>> from Tkinter import * > >>> root = Tk() > >>> tkSnack.initializeSnack(root) > Traceback (most recent call last): > File "", line 1, in > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/tkSnack.py", > line 21, in initializeSnack > Tkroot.tk.call('eval', 'package require snack') > _tkinter.TclError: couldn't load file > "/Library/Tcl/snack2.2/libsnack.dylib": > dlopen(/Library/Tcl/snack2.2/libsnack.dylib, 10): no suitable image > found. Did find: > /Library/Tcl/snack2.2/libsnack.dylib: mach-o, but wrong architecture > > Has anyone seen this? Any known fixes? > > Thanks! > Christopher Maddison Looks like you might be using an out-of-date version of Tcl/Tk that was built for the PowerPC architecture, instead of a universal binary version that supports both on OS X. I think Snack is also installed in /System/Library/Tcl. Try moving the /Library/Tcl out of the way, and trying again. It should be the correct architecture. - Kevin Walzer Code by Kevin http://www.codebykevin.com From c.j.maddison at gmail.com Mon Jun 16 22:53:53 2008 From: c.j.maddison at gmail.com (Chris Maddison) Date: Mon, 16 Jun 2008 16:53:53 -0400 Subject: [Tkinter-discuss] tkSnack In-Reply-To: <4856B080.6050703@codebykevin.com> References: <6881E783-47C0-4259-BDAC-60AEB8514A7F@gmail.com> <4856B080.6050703@codebykevin.com> Message-ID: <55BAA173-0E2D-49DA-A244-3BF44736CECB@gmail.com> I got it to work. You were right there was something wrong with the architecture. As it turns out ActiveTcl 8.5.2 has an outdated PPC snack2.2. On top of that the snack2.2.10 installer script puts the files in the wrong place. It took a little shuffling. Perhaps I will have to warn ActiveState about that. Thanks a lot! Christopher Maddison On 16-Jun-08, at 2:27 PM, Kevin Walzer wrote: > Chris Maddison wrote: >> Greetings, >> I'm new to the list. I'm a second year comp sci student putting >> together a small simple media library in Python for first year >> computer science students. I'd like to do sound, and as far as I >> can tell tkSnack is one of the simplest ways of doing that. Yet, >> with the lastest version I get the following error (I'm running >> this on Mac OS 10.5.3): >> >>> import tkSnack >> >>> from Tkinter import * >> >>> root = Tk() >> >>> tkSnack.initializeSnack(root) >> Traceback (most recent call last): >> File "", line 1, in >> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ >> python2.5/site-packages/tkSnack.py", line 21, in initializeSnack >> Tkroot.tk.call('eval', 'package require snack') >> _tkinter.TclError: couldn't load file "/Library/Tcl/snack2.2/ >> libsnack.dylib": dlopen(/Library/Tcl/snack2.2/libsnack.dylib, 10): >> no suitable image found. Did find: >> /Library/Tcl/snack2.2/libsnack.dylib: mach-o, but wrong >> architecture >> Has anyone seen this? Any known fixes? >> Thanks! >> Christopher Maddison > > Looks like you might be using an out-of-date version of Tcl/Tk that > was built for the PowerPC architecture, instead of a universal > binary version that supports both on OS X. > > I think Snack is also installed in /System/Library/Tcl. Try moving > the /Library/Tcl out of the way, and trying again. It should be the > correct architecture. > - > Kevin Walzer > Code by Kevin > http://www.codebykevin.com From bob at passcal.nmt.edu Tue Jun 17 00:48:11 2008 From: bob at passcal.nmt.edu (Bob Greschke) Date: Mon, 16 Jun 2008 16:48:11 -0600 Subject: [Tkinter-discuss] New member howdy And is there a better way to use Buttons ? In-Reply-To: References: <6CBBAEC1C23C414FB5D64484D8366A490503C2BE68@texmail.cabinc.com> <850BB7E7-1A0B-4B41-B10F-323D98BF78CA@passcal.nmt.edu> Message-ID: On Jun 12, 2008, at 12:22, Guilherme Polo wrote: >> >> ###################### >> # BEGIN: class Command >> # LIB:Command():2006.110 >> # Pass arguments to functions from button presses and menu >> selections! Nice! >> # In your declaration: ...command = Command(func, args,...) >> # Also use in bind() statements >> # x.bind("<****>", Command(func, args...)) >> class Command: >> def __init__(self, func, *args, **kw): >> self.func = func >> self.args = args >> self.kw = kw >> def __call__(self, *args, **kw): >> args = self.args+args >> kw.update(self.kw) >> apply(self.func, args, kw) >> # END: class Command >> > > You don't need all that machinery tho, something simpler like: > > def command(func, *args, **kw): > def _wrapper(*wargs): > return func(*(wargs + args), **kw) > > return _wrapper > > would work too. But considering that code is using "apply", I will > take it as really old and outdated by now. Ooo. Much better. I got mine from Grayson's book which says it originally came from a Tim Evans post to the Python newsgroup. Thanks! Bob From rowen at cesmail.net Thu Jun 19 00:09:31 2008 From: rowen at cesmail.net (Russell E. Owen) Date: Wed, 18 Jun 2008 15:09:31 -0700 Subject: [Tkinter-discuss] tkSnack References: <6881E783-47C0-4259-BDAC-60AEB8514A7F@gmail.com> <4856B080.6050703@codebykevin.com> <55BAA173-0E2D-49DA-A244-3BF44736CECB@gmail.com> Message-ID: In article <55BAA173-0E2D-49DA-A244-3BF44736CECB at gmail.com>, Chris Maddison wrote: > I got it to work. You were right there was something wrong with the > architecture. As it turns out ActiveTcl 8.5.2 has an outdated PPC > snack2.2. On top of that the snack2.2.10 installer script puts the > files in the wrong place. It took a little shuffling. Perhaps I will > have to warn ActiveState about that. I'm puzzled. I thought ActiveTcl 8.5 (unlike 8.4) came with very few extension packages -- that you had to use teacup to install extra packages (or apparently the packages installed by 8.4 are also compatible). -- Russell From yorlina007 at gmail.com Thu Jun 26 09:24:45 2008 From: yorlina007 at gmail.com (Anil Roy) Date: Thu, 26 Jun 2008 00:24:45 -0700 (PDT) Subject: [Tkinter-discuss] How to enable load button in python-tkinter widget Message-ID: <18127982.post@talk.nabble.com> Hi, I need to design a tkinter widget where i should have a browse option button as you see in all windows application to select a file from my machine. Also i need to select an integer from some dropdown box. How can i implement this... I m donewith the backend python coding.. but i need help for the front end.. please help me... Thanks, Anil Roy -- View this message in context: http://www.nabble.com/How-to-enable-load-button-in-python-tkinter-widget-tp18127982p18127982.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Thu Jun 26 17:42:01 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Thu, 26 Jun 2008 12:42:01 -0300 Subject: [Tkinter-discuss] How to enable load button in python-tkinter widget In-Reply-To: <18127982.post@talk.nabble.com> References: <18127982.post@talk.nabble.com> Message-ID: On Thu, Jun 26, 2008 at 4:24 AM, Anil Roy wrote: > > Hi, > > I need to design a tkinter widget where i should have a browse option button > as you see in all windows application to select a file from my machine. The button is a widget, a Tkinter.Button, and the file browser is another widget, tkFileDialog.Open, so they are two different things and they are both done, apparently you don't have to design them. > Also i need to select an integer from some dropdown box. You would need a combobox, which is not available in the Tkinter module but there are alternatives. Tix and Tile provide it, so you could install one of them, or you could upgrade to tk 8.5 (python 2.6b1 includes it in the Windows build). If you are going to use tile or tk 8.5 you will need a wrapper, which is not available in the python stdlib but can be found at http://gpolo.ath.cx:81/projects/ttk_to_tkinter/code > How can i implement this... I m donewith the backend python coding.. but i > need help for the front end.. > > please help me... > > Thanks, > Anil Roy > -- > View this message in context: http://www.nabble.com/How-to-enable-load-button-in-python-tkinter-widget-tp18127982p18127982.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From yorlina007 at gmail.com Fri Jun 27 07:38:00 2008 From: yorlina007 at gmail.com (Anil Roy) Date: Thu, 26 Jun 2008 22:38:00 -0700 (PDT) Subject: [Tkinter-discuss] How to enable load button in python-tkinter widget In-Reply-To: References: <18127982.post@talk.nabble.com> Message-ID: <18148483.post@talk.nabble.com> Hi Guilherme, I understood what you have said but, there is some confusion in me, because i am a biginner.. You are saying to have two widgets right, so my question is can we do this by having a single button in the displsy named as "Browse" and when we click that ,the file explorer opens ?? And does this tkFileDialog.Open returns the filename which is beign selected, or else how to get the filename being selected including the full path. Can you provide some sample code for this. Thanks a lot Anil Guilherme Polo wrote: > > On Thu, Jun 26, 2008 at 4:24 AM, Anil Roy wrote: >> >> Hi, >> >> I need to design a tkinter widget where i should have a browse option >> button >> as you see in all windows application to select a file from my machine. > > The button is a widget, a Tkinter.Button, and the file browser is > another widget, tkFileDialog.Open, so they are two different things > and they are both done, apparently you don't have to design them. > >> Also i need to select an integer from some dropdown box. > > You would need a combobox, which is not available in the Tkinter > module but there are alternatives. Tix and Tile provide it, so you > could install one of them, or you could upgrade to tk 8.5 (python > 2.6b1 includes it in the Windows build). If you are going to use tile > or tk 8.5 you will need a wrapper, which is not available in the > python stdlib but can be found at > http://gpolo.ath.cx:81/projects/ttk_to_tkinter/code > >> How can i implement this... I m donewith the backend python coding.. but >> i >> need help for the front end.. >> >> please help me... >> >> Thanks, >> Anil Roy >> -- >> View this message in context: >> http://www.nabble.com/How-to-enable-load-button-in-python-tkinter-widget-tp18127982p18127982.html >> Sent from the Python - tkinter-discuss mailing list archive at >> Nabble.com. >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> > > > > -- > -- Guilherme H. Polo Goncalves > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://www.nabble.com/How-to-enable-load-button-in-python-tkinter-widget-tp18127982p18148483.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From michael.odonnell at uam.es Fri Jun 27 12:12:29 2008 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Fri, 27 Jun 2008 12:12:29 +0200 Subject: [Tkinter-discuss] How to enable load button in python-tkinter widget In-Reply-To: <18127982.post@talk.nabble.com> References: <18127982.post@talk.nabble.com> Message-ID: <47e491110806270312h1fa07125l137f8877ca0004@mail.gmail.com> Hi Anil, A pure Tkinter dropdown box: click on a button and a menu drops down, allowing you to select. If you specify a callback function, this is called when you make a selection: from Tkinter import * import os, sys # SelecteButton Class - creates a button which when clicked on gives a popup menu. # if the callback arg is given, this is a function called when a selection is made, expecting the # selected option as arg # The value can be accessed by asking the widget for its x.selected attribute. # Coded Mick O'Donnell michael.odonnell at uam.es class SelectButton(Label): def __init__(self, parent, options, callback=None, default=None, **otherKeys): Label.__init__(self, parent, bg="white", relief="raised", bd=2, **otherKeys) self.options=options self.callback=callback self.oldGrab=None if default==None: default=self.options[0] self.bind("", self.showOptions) self.setOption(default, False) def setOption(self, selected, docallback=True): self.selected=selected self["text"]=selected if docallback and self.callback: self.callback(selected) def showOptions(self, event): menu=Menu(None, tearoff=0) for option in self.options: menu.add_command(label=option, command= lambda lab1=option: self.setOption(lab1)) menu.post(event.widget.winfo_rootx(), event.widget.winfo_rooty()) if os.name =="posix" and sys.platform != "darwin": menu.grab_set() # DEMO if __name__ == '__main__': def showSelected(label): print "You selected: ", label tk = Tk() ssw = SelectButton(tk, ['1','2','3','4','5'], callback=showSelected, default=str(2)) ssw.pack(side=TOP, expand=TRUE, fill=BOTH) tk.mainloop() From ggpolo at gmail.com Fri Jun 27 13:28:17 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Fri, 27 Jun 2008 08:28:17 -0300 Subject: [Tkinter-discuss] How to enable load button in python-tkinter widget In-Reply-To: <47e491110806270312h1fa07125l137f8877ca0004@mail.gmail.com> References: <18127982.post@talk.nabble.com> <47e491110806270312h1fa07125l137f8877ca0004@mail.gmail.com> Message-ID: On Fri, Jun 27, 2008 at 7:12 AM, Michael O'Donnell wrote: > Hi Anil, > > A pure Tkinter dropdown box: click on a button and a menu drops > down, allowing you to select. If you specify a callback function, this is called > when you make a selection: > > from Tkinter import * > import os, sys > > # SelecteButton Class - creates a button which when clicked on gives > a popup menu. > # if the callback arg is given, this is a function called when a > selection is made, expecting the > # selected option as arg > # The value can be accessed by asking the widget for its x.selected attribute. > # Coded Mick O'Donnell michael.odonnell at uam.es > > class SelectButton(Label): > > def __init__(self, parent, options, callback=None, default=None, > **otherKeys): > Label.__init__(self, parent, bg="white", relief="raised", > bd=2, **otherKeys) > self.options=options > self.callback=callback > self.oldGrab=None > if default==None: default=self.options[0] > self.bind("", self.showOptions) > self.setOption(default, False) > > def setOption(self, selected, docallback=True): > self.selected=selected > self["text"]=selected > if docallback and self.callback: > self.callback(selected) > > def showOptions(self, event): > menu=Menu(None, tearoff=0) > for option in self.options: > menu.add_command(label=option, command= lambda > lab1=option: self.setOption(lab1)) > menu.post(event.widget.winfo_rootx(), event.widget.winfo_rooty()) > if os.name =="posix" and sys.platform != "darwin": > menu.grab_set() > > # DEMO > > if __name__ == '__main__': > > def showSelected(label): print "You selected: ", label > > tk = Tk() > ssw = SelectButton(tk, ['1','2','3','4','5'], > callback=showSelected, default=str(2)) > ssw.pack(side=TOP, expand=TRUE, fill=BOTH) > tk.mainloop() If you want to go this way, then Tkinter.OptionMenu is there already. -- -- Guilherme H. Polo Goncalves From ggpolo at gmail.com Fri Jun 27 13:31:46 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Fri, 27 Jun 2008 08:31:46 -0300 Subject: [Tkinter-discuss] How to enable load button in python-tkinter widget In-Reply-To: <18148483.post@talk.nabble.com> References: <18127982.post@talk.nabble.com> <18148483.post@talk.nabble.com> Message-ID: On Fri, Jun 27, 2008 at 2:38 AM, Anil Roy wrote: > > Hi Guilherme, > > I understood what you have said but, there is some confusion in me, because > i am a biginner.. > > You are saying to have two widgets right, so my question is can we do this > by having a single button in the displsy named as "Browse" and when we click > that ,the file explorer opens ?? Yes, Yes > And does this tkFileDialog.Open returns the filename which is beign > selected, or else how to get the filename being selected including the full > path. It stores it at instance.filename > Can you provide some sample code for this. > I'm not sure if it would help you if I just gave you the code, you should be reading something to start learning Tkinter. http://www.pythonware.com/library/tkinter/introduction/index.htm http://infohost.nmt.edu/tcc/help/pubs/tkinter/index.html http://www.manning.com/grayson/ http://tkinter.unpythonic.net/wiki/ > Thanks a lot > Anil > > > Guilherme Polo wrote: >> >> On Thu, Jun 26, 2008 at 4:24 AM, Anil Roy wrote: >>> >>> Hi, >>> >>> I need to design a tkinter widget where i should have a browse option >>> button >>> as you see in all windows application to select a file from my machine. >> >> The button is a widget, a Tkinter.Button, and the file browser is >> another widget, tkFileDialog.Open, so they are two different things >> and they are both done, apparently you don't have to design them. >> >>> Also i need to select an integer from some dropdown box. >> >> You would need a combobox, which is not available in the Tkinter >> module but there are alternatives. Tix and Tile provide it, so you >> could install one of them, or you could upgrade to tk 8.5 (python >> 2.6b1 includes it in the Windows build). If you are going to use tile >> or tk 8.5 you will need a wrapper, which is not available in the >> python stdlib but can be found at >> http://gpolo.ath.cx:81/projects/ttk_to_tkinter/code >> >>> How can i implement this... I m donewith the backend python coding.. but >>> i >>> need help for the front end.. >>> >>> please help me... >>> >>> Thanks, >>> Anil Roy >>> -- >>> View this message in context: >>> http://www.nabble.com/How-to-enable-load-button-in-python-tkinter-widget-tp18127982p18127982.html >>> Sent from the Python - tkinter-discuss mailing list archive at >>> Nabble.com. >>> >>> _______________________________________________ >>> Tkinter-discuss mailing list >>> Tkinter-discuss at python.org >>> http://mail.python.org/mailman/listinfo/tkinter-discuss >>> >> >> >> >> -- >> -- Guilherme H. Polo Goncalves >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > > -- > View this message in context: http://www.nabble.com/How-to-enable-load-button-in-python-tkinter-widget-tp18127982p18148483.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From sj.m at iloinen.net Sun Jun 29 13:17:56 2008 From: sj.m at iloinen.net (Jusa) Date: Sun, 29 Jun 2008 04:17:56 -0700 (PDT) Subject: [Tkinter-discuss] TclError when destroying parent windows Message-ID: <18178579.post@talk.nabble.com> Hi, I've been browsing the tkinter documentation and I just can't seem to figure out how to fix this problem. The problem is that I get one of the following: TclError: bad window path name ".33475080.32213232" or TclError: can't invoke "toplevel" command: application has been destroyed when I destroy a parent window while child windows are being created. All of the windows are subclassed from Toplevel, and I basically have a method which creates a child window on a parent using the parent as the "master" option, and it sounds like I should check whether the parent has been destroyed before creating the child windows. However, I have no idea how I might go about doing this. Any help will be appreciated! -- View this message in context: http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18178579.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From michael.odonnell at uam.es Sun Jun 29 13:32:11 2008 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Sun, 29 Jun 2008 13:32:11 +0200 Subject: [Tkinter-discuss] TclError when destroying parent windows In-Reply-To: <18178579.post@talk.nabble.com> References: <18178579.post@talk.nabble.com> Message-ID: <47e491110806290432q10cd2ec9v6f5323f03cabfff5@mail.gmail.com> Hi Jusa, Can you post some sample code which causes the problem? Mick On Sun, Jun 29, 2008 at 1:17 PM, Jusa wrote: > > Hi, > > I've been browsing the tkinter documentation and I just can't seem to figure > out how to fix this problem. The problem is that I get one of the following: > > TclError: bad window path name ".33475080.32213232" > > or > > TclError: can't invoke "toplevel" command: application has been destroyed > > when I destroy a parent window while child windows are being created. All of > the windows are subclassed from Toplevel, and I basically have a method > which creates a child window on a parent using the parent as the "master" > option, and it sounds like I should check whether the parent has been > destroyed before creating the child windows. However, I have no idea how I > might go about doing this. > > Any help will be appreciated! > -- > View this message in context: http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18178579.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > From sj.m at iloinen.net Sun Jun 29 14:22:45 2008 From: sj.m at iloinen.net (Jusa) Date: Sun, 29 Jun 2008 05:22:45 -0700 (PDT) Subject: [Tkinter-discuss] TclError when destroying parent windows In-Reply-To: <47e491110806290432q10cd2ec9v6f5323f03cabfff5@mail.gmail.com> References: <18178579.post@talk.nabble.com> <47e491110806290432q10cd2ec9v6f5323f03cabfff5@mail.gmail.com> Message-ID: <18180082.post@talk.nabble.com> Mick O'Donnell wrote: > > Hi Jusa, > > Can you post some sample code which causes the problem? > > Mick > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > Hi Mick, It's rather lengthy but here goes (the error-causing lines are at the bottom): from Tkinter import * class MyDialog(Toplevel): ''' Base class for custom dialogs. ''' def __init__(self, master, title, size): Toplevel.__init__(self, master) self.title(title) self.accepted = False x = self.master.winfo_rootx() + self.master.winfo_width() / 2 y = self.master.winfo_rooty() + self.master.winfo_height() / 2 self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) self.wndSize = size self.geometry('+%d+%d' % (size[0], size[1])) def display(self): ''' Displays the dialog and returns the parameters polled from the user. ''' self.build() self.transient(self.master) self.grab_set() self.protocol('WN_DELETE_WINDOW', self.onCancel) x = self.master.winfo_rootx() + self.master.winfo_width() / 2 y = self.master.winfo_rooty() + self.master.winfo_height() / 2 self.geometry('+%d+%d' % (x, y)) self.wait_window(self) return self.output() def build(self): ''' Override: use this to construct the widgets on the dialog. ''' def output(self): ''' Override: use this to return any dialog-specific parameters at the end of display() ''' return None def validate(self): ''' Override: use this to validate user input in the dialog. ''' return True def onOk(self, event=None): ''' Callback for accepting the dialog. ''' if self.validate() == False: return self.accepted = True self.withdraw() self.update_idletasks() self.onCancel() def onCancel(self, event=None): ''' Callback for rejecting the dialog. ''' self.master.focus_set() self.master.grab_set() self.destroy() class MyMessageDialog(MyDialog): ''' A simple custom message dialog. ''' def __init__(self, master, title, message, btnText='Ok', size=(200, 80)): MyDialog.__init__(self, master, title, size) self.message = message self.btnText = btnText def build(self): self.frame = Frame(self, padx=7, pady=7) self.frame.pack(fill=BOTH, expand=YES) self.messageLbl = Label(self.frame, text=self.message, wraplength=self.wndSize[0]-7*2, justify=CENTER) self.messageLbl.pack(fill=BOTH, expand=YES) self.yesBtn = Button(self.frame, text=self.btnText, command=self.onOpenError) self.yesBtn.pack(pady=5) self.bind('', self.onOk) self.bind('', self.onOk) def onOpenError(self): dlg = MyMessageDialog(self, 'Watch out', 'En error occurs when you close the window \'Hello\'.', 'Don\'t press this') dlg.display() #ERROR: dlg = MyMessageDialog(self, 'Error', 'This dialog causes the error.') dlg.display() #/ERROR root = Tk() hello = MyMessageDialog(root, 'Hello', 'Good day!', 'Open error') params = hello.display() root.mainloop() -- View this message in context: http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18180082.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Sun Jun 29 16:09:07 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Sun, 29 Jun 2008 11:09:07 -0300 Subject: [Tkinter-discuss] TclError when destroying parent windows In-Reply-To: <18180082.post@talk.nabble.com> References: <18178579.post@talk.nabble.com> <47e491110806290432q10cd2ec9v6f5323f03cabfff5@mail.gmail.com> <18180082.post@talk.nabble.com> Message-ID: On Sun, Jun 29, 2008 at 9:22 AM, Jusa wrote: > > > > Mick O'Donnell wrote: >> >> Hi Jusa, >> >> Can you post some sample code which causes the problem? >> >> Mick >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > > Hi Mick, > > It's rather lengthy but here goes (the error-causing lines are at the > bottom): > > > from Tkinter import * > > class MyDialog(Toplevel): > ''' > Base class for custom dialogs. > ''' > > def __init__(self, master, title, size): > Toplevel.__init__(self, master) > > self.title(title) > self.accepted = False > > x = self.master.winfo_rootx() + self.master.winfo_width() / 2 > y = self.master.winfo_rooty() + self.master.winfo_height() / 2 > > self.columnconfigure(0, weight=1) > self.rowconfigure(0, weight=1) > > self.wndSize = size > self.geometry('+%d+%d' % (size[0], size[1])) > > def display(self): > ''' > Displays the dialog and returns the parameters polled from the user. > ''' > > self.build() > self.transient(self.master) > self.grab_set() > self.protocol('WN_DELETE_WINDOW', self.onCancel) > x = self.master.winfo_rootx() + self.master.winfo_width() / 2 > y = self.master.winfo_rooty() + self.master.winfo_height() / 2 > self.geometry('+%d+%d' % (x, y)) > self.wait_window(self) > return self.output() > > def build(self): > ''' > Override: use this to construct the widgets on the dialog. > ''' > > def output(self): > ''' > Override: use this to return any dialog-specific parameters at the > end of display() > ''' > > return None > > def validate(self): > ''' > Override: use this to validate user input in the dialog. > ''' > > return True > > def onOk(self, event=None): > ''' > Callback for accepting the dialog. > ''' > if self.validate() == False: > return > > self.accepted = True > self.withdraw() > self.update_idletasks() > self.onCancel() > > def onCancel(self, event=None): > ''' > Callback for rejecting the dialog. > ''' > self.master.focus_set() > self.master.grab_set() > self.destroy() > > class MyMessageDialog(MyDialog): > ''' > A simple custom message dialog. > ''' > > def __init__(self, master, title, message, btnText='Ok', size=(200, > 80)): > MyDialog.__init__(self, master, title, size) > > self.message = message > self.btnText = btnText > > def build(self): > self.frame = Frame(self, padx=7, pady=7) > self.frame.pack(fill=BOTH, expand=YES) > > self.messageLbl = Label(self.frame, text=self.message, > wraplength=self.wndSize[0]-7*2, justify=CENTER) > self.messageLbl.pack(fill=BOTH, expand=YES) > > self.yesBtn = Button(self.frame, text=self.btnText, > command=self.onOpenError) > self.yesBtn.pack(pady=5) > self.bind('', self.onOk) > self.bind('', self.onOk) > > def onOpenError(self): > dlg = MyMessageDialog(self, 'Watch out', 'En error occurs when you > close the window \'Hello\'.', 'Don\'t press this') > dlg.display() > Here, supposing you closed the "Hello" window, self (representing the "parent" dialog) would have been destroyed by now. Then next: > #ERROR: > dlg = MyMessageDialog(self, 'Error', 'This dialog causes the > error.') > dlg.display() > #/ERROR You try to use "self" as the parent, which is not valid anymore. You could change this to self.master, which still exists. > > root = Tk() > > hello = MyMessageDialog(root, 'Hello', 'Good day!', 'Open error') > params = hello.display() > > root.mainloop() > > -- > View this message in context: http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18180082.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From sj.m at iloinen.net Sun Jun 29 17:00:31 2008 From: sj.m at iloinen.net (Jusa) Date: Sun, 29 Jun 2008 08:00:31 -0700 (PDT) Subject: [Tkinter-discuss] TclError when destroying parent windows In-Reply-To: References: <18178579.post@talk.nabble.com> <47e491110806290432q10cd2ec9v6f5323f03cabfff5@mail.gmail.com> <18180082.post@talk.nabble.com> Message-ID: <18181762.post@talk.nabble.com> Guilherme Polo wrote: > > On Sun, Jun 29, 2008 at 9:22 AM, Jusa wrote: >> >> >> > > Here, supposing you closed the "Hello" window, self (representing the > "parent" dialog) would have been destroyed by now. > Then next: > >> #ERROR: >> dlg = MyMessageDialog(self, 'Error', 'This dialog causes the >> error.') >> dlg.display() >> #/ERROR > > You try to use "self" as the parent, which is not valid anymore. You > could change this to self.master, which still exists. > >> >> root = Tk() >> >> hello = MyMessageDialog(root, 'Hello', 'Good day!', 'Open error') >> params = hello.display() >> >> root.mainloop() >> >> -- >> View this message in context: >> http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18180082.html >> Sent from the Python - tkinter-discuss mailing list archive at >> Nabble.com. >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> > > > > -- > -- Guilherme H. Polo Goncalves > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > Hi Guilherme, Thanks for the reply. That seems to solve the error up to a point but I still get: TclError: can't invoke "toplevel" command: application has been destroyed if I destroy my application main window, which is at the top of the hierarchy so to speak. Furthermore, if I pass self.master to all of my child windows, they remain visible when the windows which create them are destroyed and I'd rather not have it like that. For example, in one scenario the user is supposed to change the application settings through these child windows and they remain visible even though the dialog which is supposed to apply the settings have been destroyed (it's also the dialog which launches these child dialogs). Is there a way to completely block the window controls, ie. the close button at the top corner of a window? -- View this message in context: http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18181762.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From Cameron at phaseit.net Sun Jun 29 17:57:19 2008 From: Cameron at phaseit.net (Cameron Laird) Date: Sun, 29 Jun 2008 15:57:19 +0000 Subject: [Tkinter-discuss] TclError when destroying parent windows In-Reply-To: <18181762.post@talk.nabble.com> References: <18178579.post@talk.nabble.com> <47e491110806290432q10cd2ec9v6f5323f03cabfff5@mail.gmail.com> <18180082.post@talk.nabble.com> <18181762.post@talk.nabble.com> Message-ID: <20080629155719.GA26103@lairds.us> On Sun, Jun 29, 2008 at 08:00:31AM -0700, Jusa wrote: . . . > Thanks for the reply. That seems to solve the error up to a point but I > still get: > > TclError: can't invoke "toplevel" command: application has been destroyed > > if I destroy my application main window, which is at the top of the > hierarchy so to speak. Furthermore, if I pass self.master to all of my child . . . > Is there a way to completely block the window controls, ie. the close button > at the top corner of a window? . . . Does leave any questions? From sj.m at iloinen.net Sun Jun 29 11:00:51 2008 From: sj.m at iloinen.net (Jusa) Date: Sun, 29 Jun 2008 02:00:51 -0700 (PDT) Subject: [Tkinter-discuss] TclError when destroying parent windows Message-ID: <18178579.post@talk.nabble.com> Hi, I've been browsing the tkinter documentation and I just can't seem to figure out how to fix this problem. The problem is that I get one of the following: TclError: bad window path name ".33475080.32213232" or TclError: can't invoke "toplevel" command: application has been destroyed when I destroy a parent window while child windows are being created. All of the windows are subclassed from Toplevel, and I basically have a method which creates a child window on a parent using the parent as the "master" option, and it sounds like I should check whether the parent has been destroyed before creating the child windows. However, I have no idea how I might go about doing this. Any help will be appreciated! -- View this message in context: http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18178579.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From sj.m at iloinen.net Sun Jun 29 18:58:58 2008 From: sj.m at iloinen.net (Jusa) Date: Sun, 29 Jun 2008 09:58:58 -0700 (PDT) Subject: [Tkinter-discuss] TclError when destroying parent windows In-Reply-To: <20080629155719.GA26103@lairds.us> References: <18178579.post@talk.nabble.com> <47e491110806290432q10cd2ec9v6f5323f03cabfff5@mail.gmail.com> <18180082.post@talk.nabble.com> <18181762.post@talk.nabble.com> <20080629155719.GA26103@lairds.us> Message-ID: <18182959.post@talk.nabble.com> Cameron Laird-2 wrote: > > On Sun, Jun 29, 2008 at 08:00:31AM -0700, Jusa wrote: > . > . > . >> Thanks for the reply. That seems to solve the error up to a point but I >> still get: >> >> TclError: can't invoke "toplevel" command: application has been >> destroyed >> >> if I destroy my application main window, which is at the top of the >> hierarchy so to speak. Furthermore, if I pass self.master to all of my >> child > . > . > . >> Is there a way to completely block the window controls, ie. the close >> button >> at the top corner of a window? > . > . > . > Does > leave any questions? > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > No, not at this point. That's what I was looking for, thank you. -- View this message in context: http://www.nabble.com/TclError-when-destroying-parent-windows-tp18178579p18182959.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From egpalma at hotmail.com Sun Jun 29 23:34:50 2008 From: egpalma at hotmail.com (EDWINFMI) Date: Sun, 29 Jun 2008 14:34:50 -0700 (PDT) Subject: [Tkinter-discuss] scrollbar Message-ID: <18185599.post@talk.nabble.com> hy guys i am developing a simple script by using tkinter, but i do not know how to include a scrollbar some ideas from Tkinter import * import tkMessageBox import grail import Pmw #========================================================== def read_economic_parameters(): print "no yet" #=========================================================== root = Tk() root.option_add('*Font', 'Verdana 10') root.title('Economic Model Sierrita, Freeport McMoran') root.geometry('700x900') Pmw.initialise() frame = Frame(root, width=500, height=400, bd=1) frame.pack() lw = Pmw.LabeledWidget(frame, labelpos='n', label_text='ECONOMIC BLOCK MODEL') lw.component('hull').configure(relief=SUNKEN, borderwidth=3) lw.pack(padx=10, pady=10) img = PhotoImage(file='LOGO.gif') cw = Button(lw.interior(), background='yellow', image=img) cw.pack(padx=10, pady=10, expand=1, fill=BOTH) button = Button(root,text="Accept",fg="red", command=read_economic_parameters) button.pack() iframe3 = Frame(frame, bd=2, relief=SUNKEN) Label(iframe3, text='Metal Price',bg='gray40',font='Verdana 10 bold').pack() PAR17 = Pmw.EntryField(iframe3, labelpos=W, value = '1.225', label_text = 'Price Cu TCu $/LB', validate = {'validator' : 'real'}) PAR18 = Pmw.EntryField(iframe3, labelpos=W, value = '6.5', label_text = 'Price Mo $/LB', validate = {'validator' : 'real'}) PAR19 = Pmw.EntryField(iframe3, labelpos=W, value = '1.225', label_text = 'Price LEACH LCU2 $/LB', validate = {'validator' : 'real'}) iframe3.pack(expand=1, fill=X, pady=10, padx=5) iframe4 = Frame(frame, bd=2, relief=SUNKEN) Label(iframe4, text='Recovery',bg='gray40',font='Verdana 10 bold').pack() PAR9 = Pmw.EntryField(iframe4, labelpos=W, value = '0', label_text = 'Recovery TCu (FRACTION)', validate = {'validator' : 'real'}) PAR10 = Pmw.EntryField(iframe4, labelpos=W, value = '0', label_text = 'Recovery Mo (FRACTION)', validate = {'validator' : 'real'}) PAR12 = Pmw.EntryField(iframe4, labelpos=W, value = '0.85', label_text = 'Recovery LCu (FRACTION)', validate = {'validator' : 'real'}) PAR11 = Pmw.EntryField(iframe4, labelpos=W, value = '0.85', label_text = 'Recovery OX2 (FRACTION)', validate = {'validator' : 'real'}) PAR33 = Pmw.EntryField(iframe4, labelpos=W, value = '0.965', label_text = 'Smelter Recovery M1 (FRACTION)', validate = {'validator' : 'real'}) PAR34 = Pmw.EntryField(iframe4, labelpos=W, value = '0.9801', label_text = 'Smelter Recovery M2 (FRACTION)', validate = {'validator' : 'real'}) PAR31 = Pmw.EntryField(iframe4, labelpos=W, value = '0.037', label_text = 'FIXED TAIL FOR MILL CU (FRACTION)', validate = {'validator' : 'real'}) PAR32 = Pmw.EntryField(iframe4, labelpos=W, value = '0.0053', label_text = 'FIXED TAIL FOR MILL MO (FRACTION)', validate = {'validator' : 'real'}) iframe4.pack(expand=1, fill=X, pady=10, padx=5) iframe5 = Frame(frame, bd=2, relief=SUNKEN) Label(iframe5, text='Mining Cost',bg='gray40',font='Verdana 10 bold').pack() PAR22 = Pmw.EntryField(iframe5, labelpos=W, value = '1.112', label_text = 'Mining Cost M1 $/TON', validate = {'validator' : 'real'}) PAR23 = Pmw.EntryField(iframe5, labelpos=W, value = '0', label_text = 'Mining Cost M2 $/TON', validate = {'validator' : 'real'}) PAR24 = Pmw.EntryField(iframe5, labelpos=W, value = '1.112', label_text = 'Mining Cost OX1 $/TON', validate = {'validator' : 'real'}) PAR25 = Pmw.EntryField(iframe5, labelpos=W, value = '0', label_text = 'Mining Cost OX2 $/TON', validate = {'validator' : 'real'}) PAR26 = Pmw.EntryField(iframe5, labelpos=W, value = '1.112', label_text = 'Mining Cost WASTE $/TON', validate = {'validator' : 'real'}) PAR27 = Pmw.EntryField(iframe5, labelpos=W, value = '0.0145', label_text = 'Variable Waste Cost per Bench $/TON', validate = {'validator' : 'real'}) PAR13 = Pmw.EntryField(iframe5, labelpos=W, value = '0.0145', label_text = 'Variable M1 Cost per Bench $/TON', validate = {'validator' : 'real'}) PAR15 = Pmw.EntryField(iframe5, labelpos=W, value = '0.0145', label_text = 'Variable OX1 Cost per Bench $/TON', validate = {'validator' : 'real'}) iframe5.pack(expand=1, fill=X, pady=10, padx=5) iframe6 = Frame(frame, bd=2, relief=SUNKEN) Label(iframe6, text='Processing Cost',bg='gray40',font='Verdana 10 bold').pack() PAR1 = Pmw.EntryField(iframe6, labelpos=W, value = '3.465', label_text = 'Processing Cost M1 $/TON', validate = {'validator' : 'real'}) PAR2 = Pmw.EntryField(iframe6, labelpos=W, value = '0', label_text = 'Processing Cost M2 $/TON', validate = {'validator' : 'real'}) PAR3 = Pmw.EntryField(iframe6, labelpos=W, value = '0.733', label_text = 'Processing Cost OX1 $/TON', validate = {'validator' : 'real'}) PAR36 = Pmw.EntryField(iframe6, labelpos=W, value = '1364', label_text = 'Moly Flotation Cost Cu Conc. $/TON', validate = {'validator' : 'real'}) PAR37 = Pmw.EntryField(iframe6, labelpos=W, value = '0.213', label_text = 'Full Moly Flotation Cost per POUND Mo, for Mo Factor Calc $/LB', validate = {'validator' : 'real'}) iframe6.pack(expand=1, fill=X, pady=10, padx=5) iframe7 = Frame(frame, bd=2, relief=SUNKEN) Label(iframe7, text='Unit Cost',bg='gray40',font='Verdana 10 bold').pack() PAR5 = Pmw.EntryField(iframe7, labelpos=W, value = '0.3286', label_text = 'Unit Cost M1 $/LB', validate = {'validator' : 'real'}) PAR6 = Pmw.EntryField(iframe7, labelpos=W, value = '0.691', label_text = 'Unit Cost M2 $/LB', validate = {'validator' : 'real'}) PAR7 = Pmw.EntryField(iframe7, labelpos=W, value = '0.79', label_text = 'Unit Cost OX1 $/LB', validate = {'validator' : 'real'}) iframe7.pack(expand=1, fill=X, pady=10, padx=5) widgets1 = (PAR5, PAR6,PAR7,PAR17, PAR18, PAR19,PAR9, PAR10,PAR12,PAR11,PAR33,PAR34,PAR31,PAR32,PAR22, PAR23,PAR24,PAR25,PAR26,PAR27,PAR13, PAR15,PAR1, PAR2,PAR3, PAR36, PAR37) for widget in widgets1: widget.pack(fill=X, expand=1, padx=10, pady=5) Pmw.alignlabels(widgets) real.component('entry').focus_set() root.mainloop() -- View this message in context: http://www.nabble.com/scrollbar-tp18185599p18185599.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Mon Jun 30 14:41:03 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Mon, 30 Jun 2008 09:41:03 -0300 Subject: [Tkinter-discuss] scrollbar In-Reply-To: <18185599.post@talk.nabble.com> References: <18185599.post@talk.nabble.com> Message-ID: On Sun, Jun 29, 2008 at 6:34 PM, EDWINFMI wrote: > > hy guys i am developing a simple script by using tkinter, but i do not know > how to include a scrollbar > some ideas I stopped reading right at "import Pmw", mainly because your email is too lenghty. There is a demo at bottom here: http://pmw.sourceforge.net/doc/ScrolledFrame.html which solves your problem supposing you need a ScrolledFrame. If it is not a ScrolledFrame that you need, resend the email with a question and a /short/ code that demonstrates what you tried and how it fails. > > from Tkinter import * > import tkMessageBox > import grail > import Pmw > > #========================================================== > def read_economic_parameters(): > print "no yet" > #=========================================================== > root = Tk() > root.option_add('*Font', 'Verdana 10') > root.title('Economic Model Sierrita, Freeport McMoran') > root.geometry('700x900') > Pmw.initialise() > > > frame = Frame(root, width=500, height=400, bd=1) > frame.pack() > > lw = Pmw.LabeledWidget(frame, labelpos='n', label_text='ECONOMIC BLOCK > MODEL') > lw.component('hull').configure(relief=SUNKEN, borderwidth=3) > lw.pack(padx=10, pady=10) > img = PhotoImage(file='LOGO.gif') > cw = Button(lw.interior(), background='yellow', image=img) > cw.pack(padx=10, pady=10, expand=1, fill=BOTH) > > > button = Button(root,text="Accept",fg="red", > command=read_economic_parameters) > button.pack() > > iframe3 = Frame(frame, bd=2, relief=SUNKEN) > Label(iframe3, text='Metal Price',bg='gray40',font='Verdana 10 bold').pack() > > PAR17 = Pmw.EntryField(iframe3, labelpos=W, value = '1.225', > label_text = 'Price Cu TCu $/LB', > validate = {'validator' : 'real'}) > > > PAR18 = Pmw.EntryField(iframe3, labelpos=W, value = '6.5', > label_text = 'Price Mo $/LB', > validate = {'validator' : 'real'}) > > PAR19 = Pmw.EntryField(iframe3, labelpos=W, value = '1.225', > label_text = 'Price LEACH LCU2 $/LB', > validate = {'validator' : 'real'}) > iframe3.pack(expand=1, fill=X, pady=10, padx=5) > > > iframe4 = Frame(frame, bd=2, relief=SUNKEN) > Label(iframe4, text='Recovery',bg='gray40',font='Verdana 10 bold').pack() > PAR9 = Pmw.EntryField(iframe4, labelpos=W, value = '0', > label_text = 'Recovery TCu (FRACTION)', > validate = {'validator' : 'real'}) > PAR10 = Pmw.EntryField(iframe4, labelpos=W, value = '0', > label_text = 'Recovery Mo (FRACTION)', > validate = {'validator' : 'real'}) > PAR12 = Pmw.EntryField(iframe4, labelpos=W, value = '0.85', > label_text = 'Recovery LCu (FRACTION)', > validate = {'validator' : 'real'}) > PAR11 = Pmw.EntryField(iframe4, labelpos=W, value = '0.85', > label_text = 'Recovery OX2 (FRACTION)', > validate = {'validator' : 'real'}) > > PAR33 = Pmw.EntryField(iframe4, labelpos=W, value = '0.965', > label_text = 'Smelter Recovery M1 (FRACTION)', > validate = {'validator' : 'real'}) > > PAR34 = Pmw.EntryField(iframe4, labelpos=W, value = '0.9801', > label_text = 'Smelter Recovery M2 (FRACTION)', > validate = {'validator' : 'real'}) > > PAR31 = Pmw.EntryField(iframe4, labelpos=W, value = '0.037', > label_text = 'FIXED TAIL FOR MILL CU (FRACTION)', > validate = {'validator' : 'real'}) > > PAR32 = Pmw.EntryField(iframe4, labelpos=W, value = '0.0053', > label_text = 'FIXED TAIL FOR MILL MO (FRACTION)', > validate = {'validator' : 'real'}) > iframe4.pack(expand=1, fill=X, pady=10, padx=5) > > iframe5 = Frame(frame, bd=2, relief=SUNKEN) > Label(iframe5, text='Mining Cost',bg='gray40',font='Verdana 10 bold').pack() > PAR22 = Pmw.EntryField(iframe5, labelpos=W, value = '1.112', > label_text = 'Mining Cost M1 $/TON', > validate = {'validator' : 'real'}) > PAR23 = Pmw.EntryField(iframe5, labelpos=W, value = '0', > label_text = 'Mining Cost M2 $/TON', > validate = {'validator' : 'real'}) > PAR24 = Pmw.EntryField(iframe5, labelpos=W, value = '1.112', > label_text = 'Mining Cost OX1 $/TON', > validate = {'validator' : 'real'}) > > PAR25 = Pmw.EntryField(iframe5, labelpos=W, value = '0', > label_text = 'Mining Cost OX2 $/TON', > validate = {'validator' : 'real'}) > > PAR26 = Pmw.EntryField(iframe5, labelpos=W, value = '1.112', > label_text = 'Mining Cost WASTE $/TON', > validate = {'validator' : 'real'}) > > PAR27 = Pmw.EntryField(iframe5, labelpos=W, value = '0.0145', > label_text = 'Variable Waste Cost per Bench $/TON', > validate = {'validator' : 'real'}) > PAR13 = Pmw.EntryField(iframe5, labelpos=W, value = '0.0145', > label_text = 'Variable M1 Cost per Bench $/TON', > validate = {'validator' : 'real'}) > PAR15 = Pmw.EntryField(iframe5, labelpos=W, value = '0.0145', > label_text = 'Variable OX1 Cost per Bench $/TON', > validate = {'validator' : 'real'}) > > iframe5.pack(expand=1, fill=X, pady=10, padx=5) > > iframe6 = Frame(frame, bd=2, relief=SUNKEN) > Label(iframe6, text='Processing Cost',bg='gray40',font='Verdana 10 > bold').pack() > PAR1 = Pmw.EntryField(iframe6, labelpos=W, value = '3.465', > label_text = 'Processing Cost M1 $/TON', > validate = {'validator' : 'real'}) > PAR2 = Pmw.EntryField(iframe6, labelpos=W, value = '0', > label_text = 'Processing Cost M2 $/TON', > validate = {'validator' : 'real'}) > PAR3 = Pmw.EntryField(iframe6, labelpos=W, value = '0.733', > label_text = 'Processing Cost OX1 $/TON', > validate = {'validator' : 'real'}) > > PAR36 = Pmw.EntryField(iframe6, labelpos=W, value = '1364', > label_text = 'Moly Flotation Cost Cu Conc. $/TON', > validate = {'validator' : 'real'}) > > PAR37 = Pmw.EntryField(iframe6, labelpos=W, value = '0.213', > label_text = 'Full Moly Flotation Cost per POUND Mo, for Mo Factor Calc > $/LB', > validate = {'validator' : 'real'}) > > > iframe6.pack(expand=1, fill=X, pady=10, padx=5) > > iframe7 = Frame(frame, bd=2, relief=SUNKEN) > Label(iframe7, text='Unit Cost',bg='gray40',font='Verdana 10 bold').pack() > PAR5 = Pmw.EntryField(iframe7, labelpos=W, value = '0.3286', > label_text = 'Unit Cost M1 $/LB', > validate = {'validator' : 'real'}) > PAR6 = Pmw.EntryField(iframe7, labelpos=W, value = '0.691', > label_text = 'Unit Cost M2 $/LB', > validate = {'validator' : 'real'}) > PAR7 = Pmw.EntryField(iframe7, labelpos=W, value = '0.79', > label_text = 'Unit Cost OX1 $/LB', > validate = {'validator' : 'real'}) > > iframe7.pack(expand=1, fill=X, pady=10, padx=5) > > > widgets1 = (PAR5, PAR6,PAR7,PAR17, PAR18, PAR19,PAR9, > PAR10,PAR12,PAR11,PAR33,PAR34,PAR31,PAR32,PAR22, > PAR23,PAR24,PAR25,PAR26,PAR27,PAR13, PAR15,PAR1, PAR2,PAR3, PAR36, PAR37) > > for widget in widgets1: > widget.pack(fill=X, expand=1, padx=10, pady=5) > > Pmw.alignlabels(widgets) > real.component('entry').focus_set() > > > root.mainloop() > > > -- > View this message in context: http://www.nabble.com/scrollbar-tp18185599p18185599.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves