From pellegrini at ill.fr Wed Sep 3 15:26:40 2008 From: pellegrini at ill.fr (pellegrini) Date: Wed, 03 Sep 2008 15:26:40 +0200 Subject: [Tkinter-discuss] Layout problem using grid manager Message-ID: <48BE9090.4040506@ill.fr> Hello Everybody, I have a problem using the grid manager. I would expect the following code to place: -button 1 and 2 at the top of the left frame -button 3 at the bottom of the left frame -button 4 at the top of the right frame Instead, it places: -button 1, 2, 3 at the center of the left frame -button 4 at the center of the right frame. Would you have any idea how what is wrong and how to solve this using the grid manager (and only this one) ? #####################################################" import Tkinter as tk root=tk.Tk() root = tk.Toplevel() frame1=tk.Frame(root,bg='black',width=200,height=300) frame1.grid(row = 0, column = 0) frame1.grid_propagate(0) button1 = tk.Button(frame1,text='button 1') button1.grid(padx=3,pady=3, sticky = N) button2 = tk.Button(frame1,text='button 2') button2.grid(padx=3,pady=3, sticky = N) button3 = tk.Button(frame1,text='button 3') button3.grid(padx=3,pady=3, sticky = S) frame2=tk.Frame(root,bg='white',width=200,height=300) frame2.grid(row = 0, column = 1) frame2.grid_propagate(0) button4 = tk.Button(frame2,text='button 4') button4.grid(padx=3,pady=3, sticky = N) root.mainloop() ############################################# thanks a lot bye Eric From reson5 at cox.net Wed Sep 3 02:16:20 2008 From: reson5 at cox.net (Reson) Date: Tue, 2 Sep 2008 17:16:20 -0700 (PDT) Subject: [Tkinter-discuss] Tkinter, toplevel and images In-Reply-To: <34936.1219425476@clix.pt> References: <34936.1219425476@clix.pt> Message-ID: <19280820.post@talk.nabble.com> Hi! changing extension to pyw (in windows) can help ;) Reson ptg wrote: > > > Hi > I'm trying to build a small application that can display some images > in a toplevel window. I have this code: > def Results(master): >     from Tkinter import Toplevel, Button, Label >     from PIL import ImageTk >     figures = ['first.png', 'second.png'] >     ResultsWindow = Toplevel(master) >     ResultsWindow.title('Results') >     picts = [ImageTk.PhotoImage(file = x) for x in figures] >     butRW = Button(ResultsWindow, text = 'CLOSE', command = > ResultsWindow.destroy) >     butRW.pack() >     height = sum([x.height() for x in picts]) >     width = picts[0].width() >     y = 0 >     for pict in picts: >         label = > Label(ResultsWindow,image=pict).pack() >         y += pict.height() > from Tkinter import Tk > root = Tk() > Results(root) > root.mainloop() > and I just can see a grey window with a "close" button... However, > when I try the same code with the root I can see both images... Can > anyone give me a tip? > Thanks! :) > > _______________________________________________ > 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/Tkinter%2C-toplevel-and-images-tp19112323p19280820.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ggpolo at gmail.com Thu Sep 4 02:55:36 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Wed, 3 Sep 2008 21:55:36 -0300 Subject: [Tkinter-discuss] ANN: Ttk wrapper 0.2.5 Message-ID: Hello, Today the ttk wrapper 0.2.5 has been released and is available at http://pypi.python.org/pypi/pyttk/0.2.5. The major highlight is that it finally includes a test suite, and while writing the tests, several bugs have been found and corrected. What is this wrapper for ? -------------------------------- 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. What is Ttk ? ---------------- The basic idea of ttk is to separate, to the extent possible, the code implementing a widget's behavior from the code implementing its appearance. Widget class bindings are primarily responsible for maintaining the widget state and invoking callbacks, all aspects of the widgets appearance lies at Themes. More informations ----------------------- http://gpolo.ath.cx:81/projects/ttk_to_tkinter Regards, -- -- Guilherme H. Polo Goncalves From amit.finkler at gmail.com Sun Sep 7 10:57:48 2008 From: amit.finkler at gmail.com (Amit Finkler) Date: Sun, 07 Sep 2008 11:57:48 +0300 Subject: [Tkinter-discuss] Hide/Show using withdraw()/deiconify() Message-ID: <48C3978C.2010502@gmail.com> Hi, I want to have a button in my root window which either hides or shows a different (Toplevel) window. I wrote the following code (assume import Tkinter) RunFrame = Tkinter.Frame(win1, bd = 2, relief = 'groove') MODES = [ ("2D-On", "1"), ("2D-Off", "2"), ] hs = Tkinter.StringVar() hs.set("1") for text, mode in MODES: Run2D = Tkinter.Radiobutton(RunFrame, text = text, variable = hs, value = mode, command = Hide_Show_2D(hs)) Run2D.pack(side = 'left') where def Hide_Show_2D(value): """ Hide or show the 2D scan windows (win4) using withdraw() and deiconify() """ if value == '2': win4.withdraw() else: win4.deiconify() and win1 = Tkinter.Tk() win1.title('Control Panel') win4 = Tkinter.Toplevel() win4.title('2D scans panel') Not surprisingly, when I push the Run2D button, nothing happens... What am I doing wrong? Your help will be greatly appreciated, Amit Finkler. From fredrik at pythonware.com Sun Sep 7 12:29:15 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 07 Sep 2008 12:29:15 +0200 Subject: [Tkinter-discuss] Hide/Show using withdraw()/deiconify() In-Reply-To: <48C3978C.2010502@gmail.com> References: <48C3978C.2010502@gmail.com> Message-ID: Amit Finkler wrote: > RunFrame = Tkinter.Frame(win1, bd = 2, relief = 'groove') your use of excessive whitespace doesn't exactly make it easier to read your code... I suggest reading PEP 8. > Run2D = Tkinter.Radiobutton(RunFrame, text = text, variable = > hs, value = mode, command = Hide_Show_2D(hs)) > Run2D.pack(side = 'left') when you write command=Hide_Show_2D(hs) Python will *call* the function, take the return value from the function, and pass *that* to the Radiobutton. try inserting a lambda: command=lambda: Hide_Show_2D(hs) ("lambda: expression" creates an anonymous function that evaluates the expression when called). > def Hide_Show_2D(value): > if value == '2': > win4.withdraw() > else: > win4.deiconify() since "value" is a Tkinter StringVar, you have to replace the test with value.get() == '2' (alternatively, change the lambda to "lambda: Hide_Show_2D(hs.get())") From ggpolo at gmail.com Sun Sep 7 14:58:15 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Sun, 7 Sep 2008 09:58:15 -0300 Subject: [Tkinter-discuss] ANN: Ttk wrapper 0.2.6 Message-ID: Hi, Another pyttk release today, it is at 0.2.6 now, and it is available at http://pypi.python.org/pypi/pyttk/0.2.6. This release fixes issue 4 (http://code.google.com/p/python-ttk/issues/detail?id=4&can=1): "Combobox values fails" And it also includes documentation, before you would need to visit my site to read it. What is this wrapper for ? -------------------------------- 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. What is Ttk ? ---------------- The basic idea of ttk is to separate, to the extent possible, the code implementing a widget's behavior from the code implementing its appearance. Widget class bindings are primarily responsible for maintaining the widget state and invoking callbacks, all aspects of the widgets appearance lies at Themes. More informations ----------------------- http://gpolo.ath.cx:81/projects/ttk_to_tkinter Regards, -- -- Guilherme H. Polo Goncalves From amit.finkler at weizmann.ac.il Sun Sep 7 10:56:08 2008 From: amit.finkler at weizmann.ac.il (Amit Finkler) Date: Sun, 07 Sep 2008 11:56:08 +0300 Subject: [Tkinter-discuss] Hide / Show using withdraw() / deiconify() Message-ID: <48C39728.9080502@weizmann.ac.il> Hi, I want to have a button in my root window which either hides or shows a different (Toplevel) window. I wrote the following code (assume import Tkinter) RunFrame = Tkinter.Frame(win1, bd = 2, relief = 'groove') MODES = [ ("2D-On", "1"), ("2D-Off", "2"), ] hs = Tkinter.StringVar() hs.set("1") for text, mode in MODES: Run2D = Tkinter.Radiobutton(RunFrame, text = text, variable = hs, value = mode, command = Hide_Show_2D(hs)) Run2D.pack(side = 'left') where def Hide_Show_2D(value): """ Hide or show the 2D scan windows (win4) using withdraw() and deiconify() """ if value == '2': win4.withdraw() else: win4.deiconify() and win1 = Tkinter.Tk() win1.title('Control Panel') win4 = Tkinter.Toplevel() win4.title('2D scans panel') Not surprisingly, when I push the Run2D button, nothing happens... What am I doing wrong? Your help will be greatly appreciated, Amit Finkler. From amit.finkler at gmail.com Mon Sep 8 20:08:31 2008 From: amit.finkler at gmail.com (Amit Finkler) Date: Mon, 08 Sep 2008 21:08:31 +0300 Subject: [Tkinter-discuss] Hide/Show using withdraw()/deiconify() Message-ID: <48C56A1F.1070909@gmail.com> Thanks for your help, Fredrik - it worked. I'm also reading PEP 8 and implementing it in my code. Amit. From Philippe-Garteiser at omrf.org Wed Sep 17 00:19:40 2008 From: Philippe-Garteiser at omrf.org (Philippe Garteiser, PhD) Date: Tue, 16 Sep 2008 17:19:40 -0500 Subject: [Tkinter-discuss] problem to update gnuplot display using a Scale widget Message-ID: <059FD0D26F097547A2FF469DB265388A05365466@dna.omrf.hsc.net.ou.edu> Hello! I am using a Tkinter GUI to operate a C binary whose input is a float number gotten from a Scale widget, and whose output is a datafile. I would like to get gnuplot to replot the datafile each time it is overwritten (in essence have the plot refreshed by the Scale slider). To do that, I pass the function "printer(self,newval)", to the Scale's command. In the printer function, I use os.system to execute the binary, and I operate gnuplot as a special file opened by os.popen, to which I write with the chevrons print statement. import os,Tkinter,string,time class MyApp: def __init__(self, parent): self.f=os.popen("gnuplot -","w") print >>self.f,"plot \"data.dat\" with lines" print >>self.f,"reread" self.myParent=parent self.myContainer1=Frame(parent) self.myContainer1.pack() self.v=DoubleVar() self.slider1=Scale(self.myParent,from_=0,to=1,resolution=0.001,command=self.printer)#variable=self.v,command=self.printer) self.slider1.pack() def printer(self,newval): os.system("/bin/generate_data_file "+str(newval)) time.sleep(0.09) print >>self.f,"replot\n" return newval root=Tk() myapp=MyApp(root) root.mainloop() Unfortunately I don't obtain the expected result. The Tk window is there with functioning slider, the generate_data_file is executed and given the proper input value from the slider, but gnuplot is still a problem. The gnuplot window only comes up when I close the Tkinter window, and shuts down rapidly. Do you have any ideas as to what I need to fix ? Also, it would be great not to have to use the pyGnuplot.py package, as the program will have to run on minimally installed boxes (i.e. standard python, no extra modules allowed). Thanks a lot ! "It does not pay to leave a live dragon out of your calculations" - Tolkien -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrewerol at gmail.com Thu Sep 18 17:08:27 2008 From: andrewerol at gmail.com (andrewerol) Date: Thu, 18 Sep 2008 18:08:27 +0300 Subject: [Tkinter-discuss] need to unify several windows in one Message-ID: <21E9625960DE402BA3602F27678B61B3@mitkoandrey> ----- Original Message ----- From: "Andrey Antonov (UCTM)" To: Sent: Wednesday, September 10, 2008 3:38 PM Subject: help: need to unify several windows in one Hi All, I have an application that has 3 windows: first window is coming from Vpython (http://vpython.org/) /for example Tk-Visual.py after the installation of vpython/ second window is a console window third window from Tkinter - full with widgets. I would like to compile my application (for example with py2exe) such that: to avoid the black console window and second to redirect it's ALL output to the text widget. Because the interface of my application is a bit clumsy, I would like to unify all these 3 windows in one. I am ready to send my application if necessary for further help. Any links, examples etc. are welcome. Thx Andrew From ggpolo at gmail.com Thu Sep 18 19:49:08 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Thu, 18 Sep 2008 14:49:08 -0300 Subject: [Tkinter-discuss] problem to update gnuplot display using a Scale widget In-Reply-To: <059FD0D26F097547A2FF469DB265388A05365466@dna.omrf.hsc.net.ou.edu> References: <059FD0D26F097547A2FF469DB265388A05365466@dna.omrf.hsc.net.ou.edu> Message-ID: On Tue, Sep 16, 2008 at 7:19 PM, Philippe Garteiser, PhD wrote: > Hello! > I am using a Tkinter GUI to operate a C binary whose input is a float number > gotten from a Scale widget, and whose output is a datafile. I would like to > get gnuplot to replot the datafile each time it is overwritten (in essence > have the plot refreshed by the Scale slider). > To do that, I pass the function "printer(self,newval)", to the Scale's > command. In the printer function, I use os.system to execute the binary, and > I operate gnuplot as a special file opened by os.popen, to which I write > with the chevrons print statement. > > import os,Tkinter,string,time > class MyApp: > def __init__(self, parent): > self.f=os.popen("gnuplot -","w") > print >>self.f,"plot \"data.dat\" with lines" > print >>self.f,"reread" > self.myParent=parent > self.myContainer1=Frame(parent) > self.myContainer1.pack() > self.v=DoubleVar() > > self.slider1=Scale(self.myParent,from_=0,to=1,resolution=0.001,command=self.printer)#variable=self.v,command=self.printer) > self.slider1.pack() > > def printer(self,newval): > os.system("/bin/generate_data_file "+str(newval)) > time.sleep(0.09) > print >>self.f,"replot\n" > return newval > root=Tk() > myapp=MyApp(root) > root.mainloop() > > Unfortunately I don't obtain the expected result. The Tk window is there > with functioning slider, the generate_data_file is executed and given the > proper input value from the slider, but gnuplot is still a problem. The > gnuplot window only comes up when I close the Tkinter window, and shuts down > rapidly. > Do you have any ideas as to what I need to fix ? You are forgetting to flush f. Do a self.f.flush() after that "reread" and "replot". > Also, it would be great not > to have to use the pyGnuplot.py package, as the program will have to run on > minimally installed boxes (i.e. standard python, no extra modules allowed). > > Thanks a lot ! > > "It does not pay to leave a live > dragon out of your calculations" > - Tolkien > > > _______________________________________________ > 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 Thu Sep 18 19:54:36 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Thu, 18 Sep 2008 14:54:36 -0300 Subject: [Tkinter-discuss] need to unify several windows in one In-Reply-To: <21E9625960DE402BA3602F27678B61B3@mitkoandrey> References: <21E9625960DE402BA3602F27678B61B3@mitkoandrey> Message-ID: On Thu, Sep 18, 2008 at 12:08 PM, andrewerol wrote: > > ----- Original Message ----- From: "Andrey Antonov (UCTM)" > To: > Sent: Wednesday, September 10, 2008 3:38 PM > Subject: help: need to unify several windows in one > > > Hi All, > > I have an application that has 3 windows: > first window is coming from Vpython (http://vpython.org/) > /for example Tk-Visual.py after the installation of vpython/ > > second window is a console window > third window from Tkinter - full with widgets. > > I would like to compile my application (for example with py2exe) such that: > to avoid the black console window and second to redirect it's ALL output to > the text widget. > Because the interface of my application is a bit clumsy, I would like to > unify all these 3 windows in one. You have 3 toplevels and want to put them all in one ? The "easiest" way would be to change them to frames and create a single main window to hold them. If you are not using any of the Wm methods, then your task is complete now. > I am ready to send my application if necessary for further help. > > Any links, examples etc. are welcome. > Thx > Andrew > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves From Philippe-Garteiser at omrf.org Thu Sep 18 21:14:12 2008 From: Philippe-Garteiser at omrf.org (Philippe Garteiser, PhD) Date: Thu, 18 Sep 2008 14:14:12 -0500 Subject: [Tkinter-discuss] problem to update gnuplot display using a Scale widget References: <059FD0D26F097547A2FF469DB265388A05365466@dna.omrf.hsc.net.ou.edu> Message-ID: <059FD0D26F097547A2FF469DB265388A05365471@dna.omrf.hsc.net.ou.edu> Brilliant ! Thanks that did it beautifully, my virtual kidney (renal function simulator) is well on its way now ! -----Original Message----- From: Guilherme Polo [mailto:ggpolo at gmail.com] Sent: Thu 9/18/2008 12:49 PM To: Philippe Garteiser, PhD; tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] problem to update gnuplot display using a Scale widget On Tue, Sep 16, 2008 at 7:19 PM, Philippe Garteiser, PhD wrote: > Hello! > I am using a Tkinter GUI to operate a C binary whose input is a float number > gotten from a Scale widget, and whose output is a datafile. I would like to > get gnuplot to replot the datafile each time it is overwritten (in essence > have the plot refreshed by the Scale slider). > To do that, I pass the function "printer(self,newval)", to the Scale's > command. In the printer function, I use os.system to execute the binary, and > I operate gnuplot as a special file opened by os.popen, to which I write > with the chevrons print statement. > > import os,Tkinter,string,time > class MyApp: > def __init__(self, parent): > self.f=os.popen("gnuplot -","w") > print >>self.f,"plot \"data.dat\" with lines" > print >>self.f,"reread" > self.myParent=parent > self.myContainer1=Frame(parent) > self.myContainer1.pack() > self.v=DoubleVar() > > self.slider1=Scale(self.myParent,from_=0,to=1,resolution=0.001,command=self.printer)#variable=self.v,command=self.printer) > self.slider1.pack() > > def printer(self,newval): > os.system("/bin/generate_data_file "+str(newval)) > time.sleep(0.09) > print >>self.f,"replot\n" > return newval > root=Tk() > myapp=MyApp(root) > root.mainloop() > > Unfortunately I don't obtain the expected result. The Tk window is there > with functioning slider, the generate_data_file is executed and given the > proper input value from the slider, but gnuplot is still a problem. The > gnuplot window only comes up when I close the Tkinter window, and shuts down > rapidly. > Do you have any ideas as to what I need to fix ? You are forgetting to flush f. Do a self.f.flush() after that "reread" and "replot". > Also, it would be great not > to have to use the pyGnuplot.py package, as the program will have to run on > minimally installed boxes (i.e. standard python, no extra modules allowed). > > Thanks a lot ! > > "It does not pay to leave a live > dragon out of your calculations" > - Tolkien > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- -- Guilherme H. Polo Goncalves -------------- next part -------------- An HTML attachment was scrubbed... URL: From ggpolo at gmail.com Fri Sep 19 19:12:58 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Fri, 19 Sep 2008 14:12:58 -0300 Subject: [Tkinter-discuss] need to unify several windows in one In-Reply-To: References: <21E9625960DE402BA3602F27678B61B3@mitkoandrey> Message-ID: On Thu, Sep 18, 2008 at 2:54 PM, Guilherme Polo wrote: > On Thu, Sep 18, 2008 at 12:08 PM, andrewerol wrote: >> >> ----- Original Message ----- From: "Andrey Antonov (UCTM)" >> To: >> Sent: Wednesday, September 10, 2008 3:38 PM >> Subject: help: need to unify several windows in one >> >> >> Hi All, >> >> I have an application that has 3 windows: >> first window is coming from Vpython (http://vpython.org/) >> /for example Tk-Visual.py after the installation of vpython/ >> >> second window is a console window >> third window from Tkinter - full with widgets. >> >> I would like to compile my application (for example with py2exe) such that: >> to avoid the black console window and second to redirect it's ALL output to >> the text widget. >> Because the interface of my application is a bit clumsy, I would like to >> unify all these 3 windows in one. > > You have 3 toplevels and want to put them all in one ? The "easiest" > way would be to change them to frames and create a single main window > to hold them. If you are not using any of the Wm methods, then your > task is complete now. Now that I looked at vpython I must say that you will have a hard time achieving this. I would stick to at least two windows, one that is handled by vpython and other by tk (where you will be able to merge tk windows into one more easily), except if you are willing to put some (or more than some) time/effort into it. > >> I am ready to send my application if necessary for further help. >> >> Any links, examples etc. are welcome. >> Thx >> Andrew >> _______________________________________________ >> 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 dmitrey15 at ukr.net Sat Sep 20 21:10:45 2008 From: dmitrey15 at ukr.net (dmitrey) Date: Sat, 20 Sep 2008 12:10:45 -0700 (PDT) Subject: [Tkinter-discuss] (newbie) can't invoke button for twice Message-ID: <19588292.post@talk.nabble.com> hi all, I have the problem: a func has been binded to a Button: RunPause = Button(root, textvariable = t, command = lambda: invokeRunPause(p)) def invokeRunPause(p): if p.state == 'init': p.state = 'running' t.set(' Pause ') p.GUI_root.update_idletasks() p.tmp_result = p.solve(*p._args, **p._kwargs) elif p.state == 'running': .... So the problem is that I can't invoke the button RunPause till my calculations (in p.solve()) will be finished. I can observe it even graphically, the button doesn't respond when it is pressed. Could anyone provide a solution? Thank you ion advance, Dmitrey. -- View this message in context: http://www.nabble.com/%28newbie%29-can%27t-invoke-button-for-twice-tp19588292p19588292.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From callen at gemini.edu Tue Sep 23 00:02:17 2008 From: callen at gemini.edu (Craig Allen) Date: Mon, 22 Sep 2008 12:02:17 -1000 Subject: [Tkinter-discuss] problem to update gnuplot display using aScale widget In-Reply-To: <059FD0D26F097547A2FF469DB265388A05365471@dna.omrf.hsc.net.ou.edu> References: <059FD0D26F097547A2FF469DB265388A05365466@dna.omrf.hsc.net.ou.edu> <059FD0D26F097547A2FF469DB265388A05365471@dna.omrf.hsc.net.ou.edu> Message-ID: <1222120937.11655.26.camel@phact.hi.gemini.edu> uninvited comment: consider matplot lib, it's much better than gnuplot imo and I say this as one that enjoyed gnuplot ease and availability (free software) for quite some time, so no aspersions cast. But really, consider matplotlib, I bet you would not regret it. cheers. On Thu, 2008-09-18 at 14:14 -0500, Philippe Garteiser, PhD wrote: > Brilliant ! Thanks that did it beautifully, my virtual kidney (renal > function simulator) is well on its way now ! > > > > -----Original Message----- > From: Guilherme Polo [mailto:ggpolo at gmail.com] > Sent: Thu 9/18/2008 12:49 PM > To: Philippe Garteiser, PhD; tkinter-discuss at python.org > Subject: Re: [Tkinter-discuss] problem to update gnuplot display using > a Scale widget > > On Tue, Sep 16, 2008 at 7:19 PM, Philippe Garteiser, PhD > wrote: > > Hello! > > I am using a Tkinter GUI to operate a C binary whose input is a > float number > > gotten from a Scale widget, and whose output is a datafile. I would > like to > > get gnuplot to replot the datafile each time it is overwritten (in > essence > > have the plot refreshed by the Scale slider). > > To do that, I pass the function "printer(self,newval)", to the > Scale's > > command. In the printer function, I use os.system to execute the > binary, and > > I operate gnuplot as a special file opened by os.popen, to which I > write > > with the chevrons print statement. > > > > import os,Tkinter,string,time > > class MyApp: > > def __init__(self, parent): > > self.f=os.popen("gnuplot -","w") > > print >>self.f,"plot \"data.dat\" with lines" > > print >>self.f,"reread" > > self.myParent=parent > > self.myContainer1=Frame(parent) > > self.myContainer1.pack() > > self.v=DoubleVar() > > > > > self.slider1=Scale(self.myParent,from_=0,to=1,resolution=0.001,command=self.printer)#variable=self.v,command=self.printer) > > self.slider1.pack() > > > > def printer(self,newval): > > os.system("/bin/generate_data_file "+str(newval)) > > time.sleep(0.09) > > print >>self.f,"replot\n" > > return newval > > root=Tk() > > myapp=MyApp(root) > > root.mainloop() > > > > Unfortunately I don't obtain the expected result. The Tk window is > there > > with functioning slider, the generate_data_file is executed and > given the > > proper input value from the slider, but gnuplot is still a problem. > The > > gnuplot window only comes up when I close the Tkinter window, and > shuts down > > rapidly. > > Do you have any ideas as to what I need to fix ? > > You are forgetting to flush f. > Do a self.f.flush() after that "reread" and "replot". > > > Also, it would be great not > > to have to use the pyGnuplot.py package, as the program will have to > run on > > minimally installed boxes (i.e. standard python, no extra modules > allowed). > > > > Thanks a lot ! > > > > "It does not pay to leave a live > > dragon out of your calculations" > > - Tolkien > > > > > > _______________________________________________ > > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ashishbitsgoa at gmail.com Tue Sep 23 12:06:55 2008 From: ashishbitsgoa at gmail.com (Ashish Sethi) Date: Tue, 23 Sep 2008 15:36:55 +0530 Subject: [Tkinter-discuss] Drop Down menu depicting system directory structure Message-ID: Hi all I am creating an application using Tkinter which requires user to input a file address (complete path). I am currently using an Entry widget for this. But I was wondering if I can use some other widget like OptionMenu to depict the entire directory and file structure on my machine so that the user can directly select any file rather than typing the entire file path. Please suggest . p.s.- I am working in unix environment From ggpolo at gmail.com Tue Sep 23 14:52:48 2008 From: ggpolo at gmail.com (Guilherme Polo) Date: Tue, 23 Sep 2008 09:52:48 -0300 Subject: [Tkinter-discuss] Drop Down menu depicting system directory structure In-Reply-To: References: Message-ID: On Tue, Sep 23, 2008 at 7:06 AM, Ashish Sethi wrote: > Hi all > I am creating an application using Tkinter which requires user to > input a file address (complete path). I am currently using an Entry > widget for this. But I was wondering if I can use some other widget > like OptionMenu to depict the entire directory and file structure on > my machine so that the user can directly select any file rather than > typing the entire file path. Please suggest . Wouldn't you prefer to use a file dialog ? Check tkFileDialog.askopenfilename > p.s.- I am working in unix environment > _______________________________________________ > 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 Tue Sep 23 14:44:10 2008 From: Cameron at phaseit.net (Cameron Laird) Date: Tue, 23 Sep 2008 12:44:10 +0000 Subject: [Tkinter-discuss] Drop Down menu depicting system directory structure In-Reply-To: References: Message-ID: <20080923124410.GA15503@lairds.us> On Tue, Sep 23, 2008 at 03:36:55PM +0530, Ashish Sethi wrote: . . . > I am creating an application using Tkinter which requires user to > input a file address (complete path). I am currently using an Entry > widget for this. But I was wondering if I can use some other widget > like OptionMenu to depict the entire directory and file structure on > my machine so that the user can directly select any file rather than > typing the entire file path. Please suggest . > p.s.- I am working in unix environment . . . Does leave any questions unanswered? From joey.varghese at gmail.com Thu Sep 25 09:04:43 2008 From: joey.varghese at gmail.com (joshua varghese) Date: Thu, 25 Sep 2008 02:04:43 -0500 Subject: [Tkinter-discuss] Fwd: FW: Tkinter script crashes In-Reply-To: <2489e600809242353j1c9d4026r52219b3f2d8752c4@mail.gmail.com> References: <003001c91ed7$f2ac7480$690ba8c0@patni.com> <2489e600809242353j1c9d4026r52219b3f2d8752c4@mail.gmail.com> Message-ID: <2dbfcb50809250004t765c7770pb8612e10b116702e@mail.gmail.com> Hi, I am using Python 2.5.2 and the tkinter module that was shipped with it. I have made an application that has two Text widgets. These widgets are populated using 'insert' method. There is a scrollbar attached to these widgets which scrolls to the very end when there is any input.( using the 'see(END)'). The script crashes with the following log. File "c:\Program Files\Python2.5\lib\lib-tk\Tkinter.py", line 1403, in __call_ _ return self.func(*args) File "D:\CODE\Backup_codes\Python_code\script.py", line 70, in set Scrollbar.set(self, *args) File "c:\Program Files\Python2.5\lib\lib-tk\Tkinter.py", line 2799, in set self.tk.call((self._w, 'set') + args) TclError: bad option "1": must be activate, cget, configure, delta, fraction, ge t, identify, or set I would appreciate any inputs you could give to debug/solve this issue. Thank you, Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Thu Sep 25 12:37:00 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 25 Sep 2008 12:37:00 +0200 Subject: [Tkinter-discuss] Fwd: FW: Tkinter script crashes In-Reply-To: <2dbfcb50809250004t765c7770pb8612e10b116702e@mail.gmail.com> References: <003001c91ed7$f2ac7480$690ba8c0@patni.com> <2489e600809242353j1c9d4026r52219b3f2d8752c4@mail.gmail.com> <2dbfcb50809250004t765c7770pb8612e10b116702e@mail.gmail.com> Message-ID: joshua varghese wrote: > I am using Python 2.5.2 and the tkinter module that was shipped with it. > I have made an application that has two Text widgets. These widgets are > populated using 'insert' method. There is a scrollbar attached to these > widgets which scrolls to the very end when there is any input.( using > the 'see(END)'). > > The script crashes with the following log. you're passing the wrong things to Scrollbar.set. I don't think we can help you any further without seeing the code that does that call. From joshua.varghese at patni.com Wed Sep 24 06:00:10 2008 From: joshua.varghese at patni.com (joshua v) Date: Wed, 24 Sep 2008 09:30:10 +0530 Subject: [Tkinter-discuss] Tkinter script crashes Message-ID: <000601c91dfa$0a8f6910$690ba8c0@patni.com> Hi, I am using Python 2.5.2 and the tkinter module that was shipped with it. I have made an application that has two Text widgets. These widgets are populated using 'insert' method. There is a scrollbar attached to these widgets which scrolls to the very end when there is any input.( using the 'see(END)'). The script, after about an hour or so of operation, crashes with the following log. File "c:\Program Files\Python2.5\lib\lib-tk\Tkinter.py", line 1403, in __call_ _ return self.func(*args) File "D:\CODE\Backup_codes\Python_code\script.py", line 70, in set Scrollbar.set(self, *args) File "c:\Program Files\Python2.5\lib\lib-tk\Tkinter.py", line 2799, in set self.tk.call((self._w, 'set') + args) TclError: bad option "1": must be activate, cget, configure, delta, fraction, ge t, identify, or set Could this be because I input too many characters simultaneously. I would appreciate any inputs you could give to debug/solve this issue. Thank you, Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Fri Sep 26 11:03:50 2008 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Fri, 26 Sep 2008 11:03:50 +0200 Subject: [Tkinter-discuss] Problems with using mouse in IDLE under Fedora Message-ID: <47e491110809260203v864d3f0ifd3ed53973af7c37@mail.gmail.com> Dear All, Sorry for being off topic, but I cannot find a better contact point for this problem, and I guess most of you use IDLE, some under Linux. I have used IDLE without problem under Windows and Mac for years, and am now working under Fedora 9.0/Gnome2.22.3, just installed IDLE via installing python-tools 2.5.1-26-fc9 IDLE works fine, except I cannot select text within any IDLE window. (I can move around using the keyboard). I can change the cursor position with a Control-click, but not with a normal click. I have seen 3 other users report this problem , but no solutions were offered. Apparently it only affects some machines/configs. Note: Desktop Effects are disabled. Any help appreciated. Mick From rtindell at cse.usf.edu Tue Sep 30 21:58:25 2008 From: rtindell at cse.usf.edu (Ralph Tindell) Date: Tue, 30 Sep 2008 15:58:25 -0400 Subject: [Tkinter-discuss] Two Listbox problem Message-ID: <008901c92336$e62e2600$b28a7200$@usf.edu> I have a Tkinter app where I have two Listbox widgets in different frames with both frames in a parent frame. I want to restrict each Listbox to one selection, but be able to make a selection in each box simultaneously. But I am only able to select one entry in the two boxes, i.e., a selection in one box forces the other box to lose its selection. At least as far as the highlighting is concerned. Anyone have any advice? Ralph Tindell Here is the relevant code segment: twoBox = Frame(frame,bd=2,relief = RAISED) iframe3 = Frame(twoBox, bd=2, relief=GROOVE) listbox1 = Listbox(iframe3, width=30, height=10) for line in ['Student One','Student Two','Student Three','Student Four']: listbox1.insert(END, line) listbox1.pack(side=LEFT,fill=X, padx=5) sb1 = Scrollbar(iframe3, orient=VERTICAL, command=listbox1.yview) sb1.pack(side=LEFT, fill=Y) listbox1.configure(yscrollcommand=sb1.set) iframe3.pack(side=LEFT) iframe2 = Frame(twoBox, bd=2,relief=GROOVE) listbox2 = Listbox(iframe2, width=30, height=10) for line in ['file1','file2','file3','file4']: listbox2.insert(END, line) listbox2.pack(side=LEFT,fill=X, padx=5) sb2 = Scrollbar(iframe2, orient=VERTICAL, command=listbox2.yview) sb2.pack(side=LEFT, fill=Y) listbox2.configure(yscrollcommand=sb2.set) iframe2.pack(side=LEFT) -------------- next part -------------- An HTML attachment was scrubbed... URL: From Cameron at phaseit.net Tue Sep 30 22:24:50 2008 From: Cameron at phaseit.net (Cameron Laird) Date: Tue, 30 Sep 2008 20:24:50 +0000 Subject: [Tkinter-discuss] Two Listbox problem In-Reply-To: <008901c92336$e62e2600$b28a7200$@usf.edu> References: <008901c92336$e62e2600$b28a7200$@usf.edu> Message-ID: <20080930202450.GA26239@lairds.us> On Tue, Sep 30, 2008 at 03:58:25PM -0400, Ralph Tindell wrote: . . . > I have a Tkinter app where I have two Listbox widgets in different frames > with both frames in a parent frame. I want to restrict each Listbox to one > selection, but be able to make a selection in each box simultaneously. But > I am only able to select one entry in the two boxes, i.e., a selection in > one box forces the other box to lose its selection. At least as far as the > highlighting is concerned. Anyone have any advice? . . . This is a FAQ. I write that to communicate that the solution is well understood, not to criticize your research. As one standard reference puts it, If you have more than one listbox on the screen, this really messes things up for the poor user. If she selects something in one listbox, and then selects something in another, the original selection disappears. Look for "exportselection=0" in .