From mikegasser at sbcglobal.net Wed Oct 4 03:27:46 2006 From: mikegasser at sbcglobal.net (Mike Gasser) Date: Tue, 3 Oct 2006 21:27:46 -0400 Subject: [Tkinter-discuss] Unicode in Tkinter in MacOS Message-ID: <9BC698CF-9A20-4B59-A1D4-EEA728136BBA@sbcglobal.net> This may be just a Mac problem, but I find that in MacOS (10.4) I can only get Tkinter to display the characters in the Latin-1 set and Japanese. Possibly others, I don't know, but many Unicode characters display as garbage characters. The simplest way to illustrate this is with the little Romanian "hello world" program that Jason Orendorff uses to illustrate Unicode display in Tkinter on his oft- cited "Unicode for Programmers" site: http://www.jorendorff.com/ articles/unicode/python.html ############################################### # hello-romanian.py - Demonstrates Tkinter's Unicode support # # This sample code accompanies the article "Unicode for Programmers" # at http://www.jorendorff.com/articles/unicode . from Tkinter import * import tkFont root = Tk() myFont = tkFont.Font(size=18) w = Label(root, text=u'Bun\u0103-diminea\u021ba, lume', font=myFont) w.pack() root.mainloop() #################################################### The two non-Latin-1 characters in the Romanian string appear as squares. This also happens when I explicitly set the font family to a Unicode font like 'Arial Unicode' or 'Lucida Grande'. Of course it's not just Romanian. I need Ethiopic in particular, and will need other character sets later on, and I can't get it to work. Am I missing something? Or is this a limitation of Tkinter in MacOS (in which case it's not going to be very useful for me)? (I'm running Python 2.5, but this happened in 2.4 too.) Mike Gasser Indiana University -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061003/b5b73885/attachment.html From mkieverpy at tlink.de Wed Oct 4 16:27:44 2006 From: mkieverpy at tlink.de (mkieverpy at tlink.de) Date: Wed, 4 Oct 2006 16:27:44 +0200 Subject: [Tkinter-discuss] Unicode in Tkinter in MacOS Message-ID: <4523c4e023bf59.54811674@> Mike Gasser wrote: > This may be just a Mac problem, but I find that in MacOS (10.4) I can > only get Tkinter to display the characters in the Latin-1 set and > Japanese. Possibly others, I don't know, but many Unicode characters > display as garbage characters. The simplest way to illustrate this > is with the little Romanian "hello world" program that Jason > Orendorff uses to illustrate Unicode display in Tkinter on his oft- > cited "Unicode for Programmers" site: http://www.jorendorff.com/ > articles/unicode/python.html > ... Earlier on this year or late last year I had similar problems (with extendedA and B characters). I finally dropped the idea. As far as I can remember from googling the web for a solution is that this problem was/is due to brokenness of Tk (Tk Aqua) on the newer MacOSs. A reference I just refound: http://aspn.activestate.com/ASPN/Mail/Message/tcl-mac/2865240 My problems were with Python 2.3.5 with Tcl/Tk 8.4. I do not follow the development on MacOS regularly, so I cannot tell you the current state of affairs. Hope this helps, Matthias Kievernagel mkiever-at-web-dot-de From mkieverpy at tlink.de Wed Oct 4 16:27:53 2006 From: mkieverpy at tlink.de (mkieverpy at tlink.de) Date: Wed, 4 Oct 2006 16:27:53 +0200 Subject: [Tkinter-discuss] Unicode in Tkinter in MacOS Message-ID: <4523c4e9577039.70960285@> Mike Gasser wrote: > This may be just a Mac problem, but I find that in MacOS (10.4) I can > only get Tkinter to display the characters in the Latin-1 set and > Japanese. Possibly others, I don't know, but many Unicode characters > display as garbage characters. The simplest way to illustrate this > is with the little Romanian "hello world" program that Jason > Orendorff uses to illustrate Unicode display in Tkinter on his oft- > cited "Unicode for Programmers" site: http://www.jorendorff.com/ > articles/unicode/python.html > ... Earlier on this year or late last year I had similar problems (with extendedA and B characters). I finally dropped the idea. As far as I can remember from googling the web for a solution is that this problem was/is due to brokenness of Tk (Tk Aqua) on the newer MacOSs. A reference I just refound: http://aspn.activestate.com/ASPN/Mail/Message/tcl-mac/2865240 My problems were with Python 2.3.5 with Tcl/Tk 8.4. I do not follow the development on MacOS regularly, so I cannot tell you the current state of affairs. Hope this helps, Matthias Kievernagel mkiever-at-web-dot-de From mkieverpy at tlink.de Wed Oct 4 16:11:03 2006 From: mkieverpy at tlink.de (mkieverpy at tlink.de) Date: Wed, 4 Oct 2006 16:11:03 +0200 Subject: [Tkinter-discuss] Unicode in Tkinter in MacOS Message-ID: <4523c0f72c6738.19110171@> Mike Gasser wrote: > This may be just a Mac problem, but I find that in MacOS (10.4) I can > only get Tkinter to display the characters in the Latin-1 set and > Japanese. Possibly others, I don't know, but many Unicode characters > display as garbage characters. The simplest way to illustrate this > is with the little Romanian "hello world" program that Jason > Orendorff uses to illustrate Unicode display in Tkinter on his oft- > cited "Unicode for Programmers" site: http://www.jorendorff.com/ > articles/unicode/python.html > ... Earlier on this year or late last year I had similar problems (with extendedA and B characters). I finally dropped the idea. As far as I can remember from googling the web for a solution is that this problem was/is due to brokenness of Tk (Tk Aqua) on the newer MacOSs. A reference I just refound: http://aspn.activestate.com/ASPN/Mail/Message/tcl-mac/2865240 My problems were with Python 2.3.5 with Tcl/Tk 8.4. I do not follow the development on MacOS regularly, so I cannot tell you the current state of affairs. Hope this helps, Matthias Kievernagel mkiever-at-web-dot-de From franz.steinhaeusler at gmx.at Thu Oct 5 10:05:51 2006 From: franz.steinhaeusler at gmx.at (Franz Steinhaeusler) Date: Thu, 05 Oct 2006 10:05:51 +0200 Subject: [Tkinter-discuss] Applications written in TkInter Message-ID: Hi, I wonder, if there is a site with a collection of written TkInter programs. I did not find any summary. for pyGtk there exist for example: http://www.pygtk.org/applications.html and for wxPython: http://wiki.wxpython.org/index.cgi/wxPythonPit_Apps -- Franz Steinhaeusler From sxn02 at yahoo.com Fri Oct 6 23:57:38 2006 From: sxn02 at yahoo.com (Sorin Schwimmer) Date: Fri, 6 Oct 2006 14:57:38 -0700 (PDT) Subject: [Tkinter-discuss] (no subject) Message-ID: <20061006215738.19482.qmail@web56009.mail.re3.yahoo.com> Hi All, I am trying to use a textbox in an undecorated window. It works under Windows, it fails under Linux. Here is a test code: from Tkinter import * root=Tk() root['bg']='' # transparent background root.overrideredirect(1) # get rid of border root.geometry("+80+120") # place on screen root.focus_set() # take focus bt=Button(text="End",command=root.quit) bt.grid(row=0, stick=E) # a button to allow window's closure tx=Text(bg='white',height=3) tx.grid() # a text widget tx.focus() # give focus to text root.mainloop() Under Linux, only mouse events are acknowledged, while the keyboard is ignored. How should I proceed? Thanks for you advice, Sorin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061006/9b57444b/attachment.html From bwmetz at att.com Sat Oct 7 00:42:08 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Fri, 6 Oct 2006 17:42:08 -0500 Subject: [Tkinter-discuss] (no subject) In-Reply-To: <20061006215738.19482.qmail@web56009.mail.re3.yahoo.com> Message-ID: <01D5341D04A2E64AB9B3457690473367029803E0@OCCLUST01EVS1.ugd.att.com> Don't know if this will make a difference, but try two things. 1st, turn off the overrideredirect and see if that changes anything. I've seen strange things with that before which caused some widgets to not behave properly at random times. 2nd, you could explicitly set the Tx master=root. I'm not sure that matters, but just a stab. B ________________________________ From: tkinter-discuss-bounces at python.org [mailto:tkinter-discuss-bounces at python.org] On Behalf Of Sorin Schwimmer Sent: Friday, October 06, 2006 2:58 PM To: tkinter-discuss at python.org Subject: [Tkinter-discuss] (no subject) Hi All, I am trying to use a textbox in an undecorated window. It works under Windows, it fails under Linux. Here is a test code: from Tkinter import * root=Tk() root['bg']='' # transparent background root.overrideredirect(1) # get rid of border root.geometry("+80+120") # place on screen root.focus_set() # take focus bt=Button(text="End",command=root.quit) bt.grid(row=0, stick=E) # a button to allow window's closure tx=Text(bg='white',height=3) tx.grid() # a text widget tx.focus() # give focus to text root.mainloop() Under Linux, only mouse events are acknowledged, while the keyboard is ignored. How should I proceed? Thanks for you advice, Sorin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061006/13d84f12/attachment.html From mkieverpy at tlink.de Sat Oct 7 10:29:43 2006 From: mkieverpy at tlink.de (mkieverpy at tlink.de) Date: Sat, 7 Oct 2006 10:29:43 +0200 Subject: [Tkinter-discuss] Textbox in undecorated window (was - no subject -) Message-ID: <452765770be708.74923591@> Sorin Schwimmer wrote: >I am trying to use a textbox in an undecorated window. It works under Windows, it fails under Linux. >Here is a test code: > ... The code works fine for me. What does not work? SuSE Linux 9.x, Python 2.4.1, Tk/Tcl 8.4.6, X11 with twm. What's your Linux configuration? Matthias Kievernagel mkiever at web dot de From sxn02 at yahoo.com Sat Oct 7 21:28:32 2006 From: sxn02 at yahoo.com (Sorin Schwimmer) Date: Sat, 7 Oct 2006 12:28:32 -0700 (PDT) Subject: [Tkinter-discuss] Textbox in undecorated window (was - no subject -) Message-ID: <20061007192832.79857.qmail@web56013.mail.re3.yahoo.com> Hi again, Thanks Bobby, thanks Mathias. Sorry for forgeting to type the subject. Right now I have the piece of code working with the overrideredirect commented out. It's not the way I wanted, but it's working. Setting the master explicitely to root doesn't help. My configuration is Gentoo (kernel 2.6.11), Python 2.4., Tcl/Tk 8.4.? (don't know how to find out the third digit), KDE 3.3 (3.4 on some other machines). What I try to accomplish is to be able to edit some text in the textbox, but not to cover too much of the screen (so the user knows the context in which the textbox was invoked and act accordingly). The problem is that my textbox is not editable. Thanks again, Sorin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061007/15f834e5/attachment.htm From sxn02 at yahoo.com Thu Oct 12 17:45:19 2006 From: sxn02 at yahoo.com (Sorin Schwimmer) Date: Thu, 12 Oct 2006 08:45:19 -0700 (PDT) Subject: [Tkinter-discuss] Fw: Tkinter's createfilehandler - attempt to run parallel threads Message-ID: <20061012154519.16225.qmail@web56003.mail.re3.yahoo.com> This question was posted on python-list at python.org, but found no answer there. Maybe here I'll be lucky... Thanks, Sorin ----- Forwarded Message ---- From: Sorin Schwimmer To: python-list at python.org Sent: Thursday, July 27, 2006 1:20:21 PM Subject: Tkinter's createfilehandler - attempt to run parallel threads Hi, The project that I'm working for runs a PostgreSQL database on a remote machine and several Python clients all over the place. The objects usualy have in their constructor a query to the database. As the query is executed on the remote machine, I'm trying to be fancy and execute it while building my Tkinter interface. The following code illustrates what I'm attempting to do: #! /usr/bin/python from pg import DB from Tkinter import * class thrd: def __init__(s,r): print 'Executing __init__' db=DB('design',host='xx.xx.xx.xx',user='yyyy') # relevant IP and user needed print 'db=DB(...' tkinter.createfilehandler(db,tkinter.READABLE|tkinter.WRITABLE,s.th) print 'createfile...' Label(r,text='Let\'s see the results').grid() print 'Label...' s.b=Button(r,text='GO') print 's.b=Button...' s.b.bind('',s.rslt) print 's.b.bind...' s.b.grid() print 's.b.grid()' print '__init__ done' def th(s,db,msk): print '->Executing th' s.r=db.query('select * from customers limit 10').getresult() # some query print '->s.r=...' tkinter.deletefilehandler(db) print '->deletefile...' db.close() print '->db.close()' print '->th done' def rslt(s,e): for i in s.r: print i if __name__=='__main__': r=Tk() t=thrd(r) r.mainloop() The output is:Executing __init__ db=DB(... createfile... Label... s.b=Button... s.b.bind... s.b.grid() __init__ done ->Executing th ->s.r=... ->deletefile... ->db.close() ->th done and it basicly shows that everything happens sequentialy. Pressing the button gives the expected result, so everything is correct. How can I obtain the desired parallelism? Thanks, Sorin Groups are talking. We?re listening. Check out the handy changes to Yahoo! Groups. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061012/74514c78/attachment.htm From roland.bencsik at ludensis.hu Mon Oct 16 12:42:01 2006 From: roland.bencsik at ludensis.hu (Bencsik Roland) Date: Mon, 16 Oct 2006 12:42:01 +0200 Subject: [Tkinter-discuss] main window closing when dialogs are open Message-ID: <453361F9.4060302@ludensis.hu> Hello Tkinter list, Could you please help me out how can I make my program exit cleanly if I pop up some dialog boxes? My sample code is below. When I execute python WindowClosingTest.py, open the dialog by pressing the Info button and close the program by clicking on the close button (X) of the main window than the dialog box and the main window disappears but the python interpreter does not exits. If I close the dialog before pressing the window closing button then it works fine. I use Linux (Fedora Core 5), KDE (3.5.4), Python with shipped Tkinter (2.4.3) Thanks in advance, Roland # File: WindowClosingTest.py from Tkinter import Tk from Tkinter import Button from Tkconstants import LEFT import tkMessageBox class Gui: def __init__(self, owner): self.owner = owner Button(owner, text="Info", command=self.info).pack(side=LEFT) Button(owner, text="Quit", command=self.quit).pack(side=LEFT) def quit(self): print "quit starts" print "cleaning up things..." self.owner.destroy() print "quit ends" def info(self): tkMessageBox.showinfo( "title", "message", parent=self.owner ) root = Tk() gui = Gui(root) root.protocol("WM_DELETE_WINDOW", gui.quit) root.mainloop() print "after mainloop" # EOF From klappnase at web.de Mon Oct 16 22:11:53 2006 From: klappnase at web.de (Michael Lange) Date: Mon, 16 Oct 2006 22:11:53 +0200 Subject: [Tkinter-discuss] main window closing when dialogs are open In-Reply-To: <453361F9.4060302@ludensis.hu> References: <453361F9.4060302@ludensis.hu> Message-ID: <20061016221153.353cff28.klappnase@web.de> On Mon, 16 Oct 2006 12:42:01 +0200 Bencsik Roland wrote: > Hello Tkinter list, > > Could you please help me out how can I make my program exit cleanly if I > pop up some dialog boxes? > > My sample code is below. > > When I execute python WindowClosingTest.py, open the dialog by pressing > the Info button and close the program by clicking on the close button > (X) of the main window than the dialog box and the main window > disappears but the python interpreter does not exits. > If I close the dialog before pressing the window closing button then it > works fine. > Hi Roland, I changed your code a little into this: # File: WindowClosingTest.py from Tkinter import Tk from Tkinter import Button from Tkconstants import LEFT import tkMessageBox class Gui: def __init__(self, owner): self.owner = owner Button(owner, text="Info", command=self.info).pack(side=LEFT) Button(owner, text="Quit", command=self.quit).pack(side=LEFT) def quit(self): print "quit starts" print "cleaning up things..." self.owner.quit() print "quit ends" def info(self): tkMessageBox.showinfo( "title", "message", parent=self.owner ) root = Tk() gui = Gui(root) root.protocol("WM_DELETE_WINDOW", gui.quit) root.mainloop() root.destroy() print "after mainloop" # EOF This way, using quit() instead of destroy(), at least the windows do not disappear and leave you with a "ghost" process. I hope this helps Michael From roland.bencsik at ludensis.hu Tue Oct 17 10:03:24 2006 From: roland.bencsik at ludensis.hu (Bencsik Roland) Date: Tue, 17 Oct 2006 10:03:24 +0200 Subject: [Tkinter-discuss] main window closing when dialogs are open] Message-ID: <45348E4C.7000508@ludensis.hu> Michael Lange wrote: > On Mon, 16 Oct 2006 12:42:01 +0200 > Bencsik Roland wrote: > >> Hello Tkinter list, >> >> Could you please help me out how can I make my program exit cleanly if I >> pop up some dialog boxes? >> >> My sample code is below. >> >> When I execute python WindowClosingTest.py, open the dialog by pressing >> the Info button and close the program by clicking on the close button >> (X) of the main window than the dialog box and the main window >> disappears but the python interpreter does not exits. >> If I close the dialog before pressing the window closing button then it >> works fine. >> > > This way, using quit() instead of destroy(), at least the windows do not disappear > and leave you with a "ghost" process. Hi Michael, Although your version works well, I am still not satisfied with the result, because the user does not know why the program is still running when she pressed the close button. So, currently I route the WM_DELETE_WINDOW to a warning dialog which asks the user to use the quit method what the program offer. Unfortunately this version also has a problem that in some cases the warning dialog erases the already popped up dialog. Best would be if somehow all the windows and dialogs could be closed and the program be terminated after the clean up tasks are done. The modified code is below: # File: WindowClosingTest.py from Tkinter import Tk from Tkinter import Button from Tkconstants import LEFT import tkMessageBox import tkFileDialog class Gui: def __init__(self, owner): self.owner = owner Button(owner, text="Info", command=self.info).pack(side=LEFT) Button( owner, text="Choose directory", command=self.chooseDirectory ).pack(side=LEFT) Button(owner, text="Quit", command=self.quit).pack(side=LEFT) def quit(self): print "quit starts" print "cleaning up things..." self.owner.quit() print "quit ends" def info(self): tkMessageBox.showinfo( "title", "message", parent=self.owner ) def chooseDirectory(self): tkFileDialog.askdirectory(parent=self.owner) def deleteWindow(self): tkMessageBox.showwarning( "Quit", "Use 'Quit' button to end program cleanly!", parent=self.owner ) root = Tk() gui = Gui(root) root.protocol("WM_DELETE_WINDOW", gui.deleteWindow) root.mainloop() root.destroy() print "after mainloop" # EOF From klappnase at web.de Tue Oct 17 12:02:13 2006 From: klappnase at web.de (Michael Lange) Date: Tue, 17 Oct 2006 12:02:13 +0200 Subject: [Tkinter-discuss] main window closing when dialogs are open In-Reply-To: <45348E1B.1040301@ludensis.hu> References: <453361F9.4060302@ludensis.hu> <20061016221153.353cff28.klappnase@web.de> <45348E1B.1040301@ludensis.hu> Message-ID: <20061017120213.78b59429.klappnase@web.de> On Tue, 17 Oct 2006 10:02:35 +0200 Bencsik Roland wrote: > Hi Michael, > > Although your version works well, I am still not satisfied with the > result, because the user does not know why the program is still running > when she pressed the close button. > So, currently I route the WM_DELETE_WINDOW to a warning dialog which > asks the user to use the quit method what the program offer. > Unfortunately this version also has a problem that in some cases the > warning dialog erases the already popped up dialog. > > Best would be if somehow all the windows and dialogs could be closed and > the program be terminated after the clean up tasks are done. > Hi Roland, I don't know if this is possible at all, even sys.exit() does not seem to work. Maybe instead of the additional warning dialog you could change the WM_DELETE_WINDOW callback while the dialog is up, like def info(self): self.owner.protocol('WM_DELETE_WINDOW', self.bell) tkMessageBox.showinfo() self.owner.protocol('WM_DELETE_WINDOW', self.quit) However this might become complicated in a bigger app with lots of message boxes. Maybe a separate messagebox module would help. Alternatively you could write your own replacement for tkMessageBox; if the dialog is derived from Toplevel you should be able to close all windows from the main window's "close" button. Michael From roland.bencsik at ludensis.hu Tue Oct 17 12:54:43 2006 From: roland.bencsik at ludensis.hu (Bencsik Roland) Date: Tue, 17 Oct 2006 12:54:43 +0200 Subject: [Tkinter-discuss] main window closing when dialogs are open In-Reply-To: <20061017120213.78b59429.klappnase@web.de> References: <453361F9.4060302@ludensis.hu> <20061016221153.353cff28.klappnase@web.de> <45348E1B.1040301@ludensis.hu> <20061017120213.78b59429.klappnase@web.de> Message-ID: <4534B673.5080102@ludensis.hu> Michael Lange wrote: > Hi Roland, > > I don't know if this is possible at all, even sys.exit() does not seem to work. > Maybe instead of the additional warning dialog you could change the WM_DELETE_WINDOW > callback while the dialog is up, like > > def info(self): > self.owner.protocol('WM_DELETE_WINDOW', self.bell) > tkMessageBox.showinfo() > self.owner.protocol('WM_DELETE_WINDOW', self.quit) > > However this might become complicated in a bigger app with lots of message boxes. > Maybe a separate messagebox module would help. Using bell sounds well, maybe I will use it, thanks. > Alternatively you could write your own replacement for tkMessageBox; if the > dialog is derived from Toplevel you should be able to close all windows from > the main window's "close" button. Beside tkMessageBox I would like to use the file/directory choosing methods from tkFileDialog which seems to me that I can not simply replace with my own variant. If there is no simple way to do this window closing thing then I will stay at the warning dialog or the bell ringing. Thanks for your help, Roland From sxn02 at yahoo.com Thu Oct 19 18:53:40 2006 From: sxn02 at yahoo.com (Sorin Schwimmer) Date: Thu, 19 Oct 2006 09:53:40 -0700 (PDT) Subject: [Tkinter-discuss] bwidget combobox with images - need help Message-ID: <20061019165340.23904.qmail@web56010.mail.re3.yahoo.com> Hi, I am trying to build a combobox that has some small icons beside the textual options (kind of like the favicons in bookmarks in web browsers). I found that bwidget has such a think, but I'm not sure how to use it. Does anybody has an example? Thanks, Sorin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061019/c590c1d6/attachment.htm From olivier.feys at gmail.com Fri Oct 20 09:43:30 2006 From: olivier.feys at gmail.com (Olivier Feys) Date: Fri, 20 Oct 2006 09:43:30 +0200 Subject: [Tkinter-discuss] Hide command prompt Message-ID: <45387E22.6070109@gmail.com> Hi all, I'm launching a Tkinter applilcation with a ms-dos bat file under windows. Is it possible to hide this window or to integrate it in the application ? Thanks Olivier From fredrik at pythonware.com Fri Oct 20 10:38:06 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 20 Oct 2006 10:38:06 +0200 Subject: [Tkinter-discuss] Hide command prompt References: <45387E22.6070109@gmail.com> Message-ID: Olivier Feys wrote: > I'm launching a Tkinter applilcation with a ms-dos bat file under windows. > Is it possible to hide this window or to integrate it in the application ? I just posted this to comp.lang.python, in response to someone called "Fidel": assuming Windows, and assuming that you have a standard Python install for Windows: use "pyw" instead of "py" as the script's extension. (Windows applications come in two flavours: console applications and window applications. the default executable for "py" files is "python.exe", which is a con- sole application. "pyw" uses "pythonw.exe" instead, which is exactly the same program, but linked as a window application instead). From haofast2006 at hotmail.com Fri Oct 20 15:31:33 2006 From: haofast2006 at hotmail.com (V H) Date: Fri, 20 Oct 2006 13:31:33 +0000 Subject: [Tkinter-discuss] about getting cursor's position Message-ID: Hi, I have created a Text on a Frame. A button "Mark" can change the color of the second line in the Text. When the cursor moves to the second line, some explaination is needed. I use Toplevel for that. Now I prefer the Toplevel window is generated besides the cursor. How can I get the position of the cursor? It should not be the relative position because the fuction geometry() uses the absolute one. Thanks in advance. best regards, Weining Following is the code: from Tkinter import * class App: def __init__(self, master): frame = Frame(master) self.master = master self.text = Text(frame) self.text.insert(END,"line1\n") self.text.insert(END,"line2\n") self.text.insert(END,"line3") self.text.pack() b = Button(frame, text = 'Mark', command= self.markit).pack() frame.pack() def markit(self): line2= self.text.get(2.0, 3.0) h1= 'h11' self.text.tag_config(h1,foreground= 'blue', wrap= WORD, font = 'system 12 bold') self.text.tag_bind(h1, "", self.show_warning) self.text.tag_bind(h1, "", self.hide_warning) self.text.delete(2.0, 3.0) self.text.insert(2.0, line2, h1) def show_warning(self, event): self.win = Toplevel(self.master) l = Label(self.win, text = "Some error.").pack() self.win.geometry('+400+200') def hide_warning(self, event): self.win.destroy() root = Tk() app = App(root) root.mainloop() _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ From dblank at brynmawr.edu Fri Oct 20 15:04:15 2006 From: dblank at brynmawr.edu (dblank at brynmawr.edu) Date: Fri, 20 Oct 2006 09:04:15 -0400 (EDT) Subject: [Tkinter-discuss] Tkinter and IDLE Message-ID: <2295.68.34.179.248.1161349455.squirrel@webmail.brynmawr.edu> This may be more of an IDLE question than Tkinter, but it does involve the technology of running Tkinter so I thought I'd try here. What is the best way to popup a non-application (not running mainloop) Tk window in IDLE? I have found that code that just makes a Tkinter window behaves differently in IDLE depending on whether IDLE is running with subprocesses or not. Furthermore, it seems yet-again different if one is running pythonw.exe in Windows. Is there one way that works in all situations? Or is there a standard way of telling which IDLE mode (subprocesses or non-subprocesses) mode we are running, and then do different things based on the mode? I'm trying to show a window that has a button that can be pushed, but still allow people to type at the IDLE shell prompt. Maybe I've missed some documentation somewhere that describes the pitfalls of using Tkinter with IDLE? Thanks for any leads, -Doug From fredrik at pythonware.com Fri Oct 20 15:36:47 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 20 Oct 2006 15:36:47 +0200 Subject: [Tkinter-discuss] about getting cursor's position References: Message-ID: "V H" wrote: > I have created a Text on a Frame. A button "Mark" can change the color of > the second line in the Text. When the cursor moves to the second line, some > explaination is needed. I use Toplevel for that. > > Now I prefer the Toplevel window is generated besides the cursor. How can I > get the position of the cursor? It should not be the relative position > because the fuction geometry() uses the absolute one. you can use the x_root and y_root event attributes to get the "absolute" pointer location. From stewart.midwinter at gmail.com Fri Oct 20 16:12:33 2006 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Fri, 20 Oct 2006 08:12:33 -0600 Subject: [Tkinter-discuss] Tkinter and IDLE In-Reply-To: <2295.68.34.179.248.1161349455.squirrel@webmail.brynmawr.edu> References: <2295.68.34.179.248.1161349455.squirrel@webmail.brynmawr.edu> Message-ID: On 10/20/06, dblank at brynmawr.edu wrote: > > What is the best way to popup a non-application (not running mainloop) Tk > window in IDLE? Did you try Toplevel? S From dblank at brynmawr.edu Fri Oct 20 19:28:30 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri, 20 Oct 2006 13:28:30 -0400 Subject: [Tkinter-discuss] Tkinter and IDLE In-Reply-To: References: <2295.68.34.179.248.1161349455.squirrel@webmail.brynmawr.edu> Message-ID: <4539073E.7020406@brynmawr.edu> Stewart Midwinter wrote: > On 10/20/06, dblank at brynmawr.edu wrote: >> >> What is the best way to popup a non-application (not running mainloop) Tk >> window in IDLE? > > Did you try Toplevel? So, specifically, the issue is that if I enter these commands: import Tkinter tl = Tkinter.Toplevel() I get different behavior depending on whether Idle is running with subprocesses (normal) or without subprocesses (with the -n). With subprocesses, the only way that I have figured out to make the window appear is to issue: tl.mainloop() but then I loose the ability to enter commands in the Idle window. Is there code that will make Tkinter run the same (and show the window) under both versions? -Doug > S > > From stewart at midwinter.ca Fri Oct 20 20:50:50 2006 From: stewart at midwinter.ca (Stewart Midwinter) Date: Fri, 20 Oct 2006 12:50:50 -0600 Subject: [Tkinter-discuss] Tkinter and IDLE In-Reply-To: <4539073E.7020406@brynmawr.edu> References: <2295.68.34.179.248.1161349455.squirrel@webmail.brynmawr.edu> <4539073E.7020406@brynmawr.edu> Message-ID: there are known issues in running Tkinter apps from within Idle, since it is itself a Tkinter app. Some people would even suggest that you avoid it entirely. Is there a particular reason why you are forced to run your app from within Idle? S From dblank at brynmawr.edu Fri Oct 20 20:58:34 2006 From: dblank at brynmawr.edu (dblank at brynmawr.edu) Date: Fri, 20 Oct 2006 14:58:34 -0400 (EDT) Subject: [Tkinter-discuss] Tkinter and IDLE In-Reply-To: References: <2295.68.34.179.248.1161349455.squirrel@webmail.brynmawr.edu> <4539073E.7020406@brynmawr.edu> Message-ID: <1264.68.34.179.248.1161370714.squirrel@webmail.brynmawr.edu> > there are known issues in running Tkinter apps from within Idle, since > it is itself a Tkinter app. Some people would even suggest that you > avoid it entirely. Is there a particular reason why you are forced to > run your app from within Idle? I'm starting to think that just marking idle with "do not enter" should be our approach, too. We are working on an educational python library to teach CS1 to control robots. I was hoping that people could use whatever IDE they wanted, but it looks like idle wasn't designed to play nicely with user's Tkinter code. In any event, we'll continue to use Tkinter, at least until we switch to IronPython. Anyone thinking about Tkinter for IronPython? -Doug > S > From stewart at midwinter.ca Fri Oct 20 21:48:25 2006 From: stewart at midwinter.ca (Stewart Midwinter) Date: Fri, 20 Oct 2006 13:48:25 -0600 Subject: [Tkinter-discuss] Tkinter and IDLE In-Reply-To: <1264.68.34.179.248.1161370714.squirrel@webmail.brynmawr.edu> References: <2295.68.34.179.248.1161349455.squirrel@webmail.brynmawr.edu> <4539073E.7020406@brynmawr.edu> <1264.68.34.179.248.1161370714.squirrel@webmail.brynmawr.edu> Message-ID: Michael Foord, aka fuzzyman, who hangs out on this forum some times, is now developing with IronPython, so he may have some thoughts about Tkinter on IronPython. cheers S From bwmetz at att.com Sat Oct 21 06:27:42 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Fri, 20 Oct 2006 23:27:42 -0500 Subject: [Tkinter-discuss] Tkinter and IDLE In-Reply-To: Message-ID: <01D5341D04A2E64AB9B345769047336702AF8BE3@OCCLUST01EVS1.ugd.att.com> How are you starting IDLE? When I edit my programs via IDLE you can run the app without the mainloop call to display the GUI and allow interaction while still accessing the vars and such via the IDLE window. Are you wanting to load existing code that displays a button but leaves your IDLE session, for lack of a better word, blocking in the mainloop so students can manually enter code that affects the program? B -----Original Message----- From: tkinter-discuss-bounces at python.org [mailto:tkinter-discuss-bounces at python.org] On Behalf Of Stewart Midwinter Sent: Friday, October 20, 2006 12:48 PM To: dblank at brynmawr.edu Cc: Tkinter of Python Subject: Re: [Tkinter-discuss] Tkinter and IDLE Michael Foord, aka fuzzyman, who hangs out on this forum some times, is now developing with IronPython, so he may have some thoughts about Tkinter on IronPython. cheers S _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss From sxn02 at yahoo.com Mon Oct 23 20:07:41 2006 From: sxn02 at yahoo.com (Sorin Schwimmer) Date: Mon, 23 Oct 2006 11:07:41 -0700 (PDT) Subject: [Tkinter-discuss] Tkinter question Message-ID: <20061023180741.71666.qmail@web56002.mail.re3.yahoo.com> Hi All, Is it possible to have a widget id while it is created? Something like this: Button(root, text='...', command= lambda v=: fn(v)).grid() and then the function: def fn(v): v['bg']='BLUE' # or maybe nametowidget(v)['bg']='BLUE' Thanks, Sorin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061023/3756349a/attachment.htm From fredrik at pythonware.com Mon Oct 23 20:14:35 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 23 Oct 2006 20:14:35 +0200 Subject: [Tkinter-discuss] Tkinter question In-Reply-To: <20061023180741.71666.qmail@web56002.mail.re3.yahoo.com> References: <20061023180741.71666.qmail@web56002.mail.re3.yahoo.com> Message-ID: Sorin Schwimmer wrote: > Is it possible to have a widget id while it is created? no, because the arguments to the constructor are evaluated *before* the constructor is called. > Something like this: > > Button(root, text='...', command= lambda v=: fn(v)).grid() use lexical scoping: b = Button(root, text='...', command=lambda: fn(b)) b.grid() or, if you're doing this in a loop: b = Button(root, text='...') b.config(command=lambda b=b: fn(b)) b.grid() From Vasilis.Vlachoudis at cern.ch Tue Oct 24 12:33:33 2006 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Tue, 24 Oct 2006 12:33:33 +0200 Subject: [Tkinter-discuss] OptionMenu, change the list of choices Message-ID: <453DEBFD.5010007@cern.ch> Dear All, I want to use the OptionMenu, in which I want to dynamically change the list of choices. Something like values=["One","Two","Three"] # Initial list o = OptionMenu(frame, *values) #... #then later in the code read new values from a file newvalues = f.readline().split() o.config(???=newvalues) I couldn't find any method on how to do this. Cheers Vasilis -------------- next part -------------- A non-text attachment was scrubbed... Name: Vasilis.Vlachoudis.vcf Type: text/x-vcard Size: 312 bytes Desc: not available Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20061024/4285e4dd/attachment.vcf From mkieverpy at tlink.de Tue Oct 24 15:51:37 2006 From: mkieverpy at tlink.de (mkieverpy at tlink.de) Date: Tue, 24 Oct 2006 15:51:37 +0200 Subject: [Tkinter-discuss] OptionMenu, change the list of choices Message-ID: <453e1a69c40be8.55531666@> Vasilis Vlachoudis wrote: > > values=["One","Two","Three"] # Initial list > o = OptionMenu(frame, *values) > #... > #then later in the code read new values from a file > newvalues = f.readline().split() > o.config(???=newvalues) > With m = o.children ['menu'] you can access the menu which implements the OptionMenu. OptionMenu uses 'command' entries. So you can add new entries with m.add_command(label='a_new_entry',command=if_you_need_to_set_a_var_or_something) I never used this personally. Hope it works for you. Matthias Kievernagel mkiever at web dot de From haofast2006 at hotmail.com Tue Oct 24 16:40:38 2006 From: haofast2006 at hotmail.com (V H) Date: Tue, 24 Oct 2006 14:40:38 +0000 Subject: [Tkinter-discuss] question on tab window Message-ID: Hi, Does Tkinter offer some simple solution for creating tab windows? Some examples? best regards, Weining _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ From ajkadri at googlemail.com Tue Oct 24 17:03:38 2006 From: ajkadri at googlemail.com (Asrarahmed Kadri) Date: Tue, 24 Oct 2006 16:03:38 +0100 Subject: [Tkinter-discuss] question on tab window In-Reply-To: References: Message-ID: ARe you referring to toplevel windows...?? If yes, then you can create them as below: win1 = Toplevel() win2 = Toplevel() HTH. Asrarahmed On 10/24/06, V H wrote: > > Hi, > > Does Tkinter offer some simple solution for creating tab windows? Some > examples? > > best regards, > Weining > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- To HIM you shall return. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061024/68fc4222/attachment.htm From mail at microcorp.co.za Tue Oct 24 07:48:51 2006 From: mail at microcorp.co.za (Hendrik van Rooyen) Date: Tue, 24 Oct 2006 07:48:51 +0200 Subject: [Tkinter-discuss] Tkinter question References: <20061023180741.71666.qmail@web56002.mail.re3.yahoo.com> Message-ID: <021901c6f734$cc870a80$03000080@hendrik> Sorin Schwimmer wrote: Hi All, Is it possible to have a widget id while it is created? Something like this: Button(root, text='...', command= lambda v=: fn(v)).grid() and then the function: def fn(v): v['bg']='BLUE' # or maybe nametowidget(v)['bg']='BLUE' Thanks, Sorin - just give the thing a name when you make it: MyFirstButton = Button(..... or possibly if its in a class: self.MyFirstButton = Button(..... then use self.MyFirstButton.configure('bg' = 'blue', 'text' = 'new description on the button') HTH Hendrik From roland.bencsik at ludensis.hu Tue Oct 24 17:16:09 2006 From: roland.bencsik at ludensis.hu (Bencsik Roland) Date: Tue, 24 Oct 2006 17:16:09 +0200 Subject: [Tkinter-discuss] question on tab window In-Reply-To: References: Message-ID: <453E2E39.2060306@ludensis.hu> Hi, Altough it is a quite old package (August 4, 2003) you may try Python megawidgets: http://pmw.sourceforge.net/ There is a good demo included showing its widgets in action. Roland V H wrote: > Hi, > > Does Tkinter offer some simple solution for creating tab windows? Some > examples? > > best regards, > Weining > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > From Vasilis.Vlachoudis at cern.ch Tue Oct 24 17:30:28 2006 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Tue, 24 Oct 2006 17:30:28 +0200 Subject: [Tkinter-discuss] OptionMenu, change the list of choices In-Reply-To: <453e1a69c40be8.55531666@> References: <453e1a69c40be8.55531666@> Message-ID: <453E3194.2040508@cern.ch> Thank you very much. It seems it works. How ever, if I don't use a command=lambda... in the add_command I cannot get the OptionMenu value changed (see below). Is it really necessary all the lambda... function I am doing or there is a smarter way of doing the job? Regards Vasillis -------- from Tkinter import * values = ["one","two","three"] root = Tk() var = StringVar() var.set(values[0]) # set initial options o = OptionMenu(root,var,*values) o.pack() # change options m = o.children['menu'] m.delete(0,END) newvalues = "a b c d e f".split() for val in newvalues: m.add_command(label=val,command=lambda v=var,l=val:v.set(l)) var.set(newvalues[0]) root.mainloop() --------- mkieverpy at tlink.de wrote: > Vasilis Vlachoudis wrote: > >> values=["One","Two","Three"] # Initial list >> o = OptionMenu(frame, *values) >> #... >> #then later in the code read new values from a file >> newvalues = f.readline().split() >> o.config(???=newvalues) >> >> > With > m = o.children ['menu'] > you can access the menu which implements the OptionMenu. > OptionMenu uses 'command' entries. > So you can add new entries with > m.add_command(label='a_new_entry',command=if_you_need_to_set_a_var_or_something) > I never used this personally. > Hope it works for you. > > Matthias Kievernagel > mkiever at web dot de > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- A non-text attachment was scrubbed... Name: Vasilis.Vlachoudis.vcf Type: text/x-vcard Size: 312 bytes Desc: not available Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20061024/a98344cf/attachment.vcf From Cameron at phaseit.net Tue Oct 24 17:54:13 2006 From: Cameron at phaseit.net (Cameron Laird) Date: Tue, 24 Oct 2006 15:54:13 +0000 Subject: [Tkinter-discuss] OptionMenu, change the list of choices In-Reply-To: <453E3194.2040508@cern.ch> References: <453e1a69c40be8.55531666@> <453E3194.2040508@cern.ch> Message-ID: <20061024155413.GB17444@lairds.us> On Tue, Oct 24, 2006 at 05:30:28PM +0200, Vasilis Vlachoudis wrote: . . . > changed (see below). Is it really necessary all the lambda... function I > am doing or there is a smarter way of doing the job? . . . In general, any time you code with a lambda (an anonymous function), you might equally well choose to define a named function, and use that instead. The choice between them is a matter of style, for comparable functionality is avail- able either way. Modern Python style generally *deprecates* lambdas in favor of named functions. Tkinter might be one of the domains where lambdas are most common. From Cameron at phaseit.net Tue Oct 24 18:15:24 2006 From: Cameron at phaseit.net (Cameron Laird) Date: Tue, 24 Oct 2006 16:15:24 +0000 Subject: [Tkinter-discuss] question on tab window In-Reply-To: References: Message-ID: <20061024161523.GA31240@lairds.us> On Tue, Oct 24, 2006 at 02:40:38PM +0000, V H wrote: . . . > Does Tkinter offer some simple solution for creating tab windows? Some > examples? . . . When you write "tab", my guess is that the keyword you're after is "notebook", so likely will help. Jeff Epler or other Wiki administrator: I'm having trouble logging in to the Wiki. Please e-mail me. From sxn02 at yahoo.com Tue Oct 24 19:31:42 2006 From: sxn02 at yahoo.com (Sorin Schwimmer) Date: Tue, 24 Oct 2006 10:31:42 -0700 (PDT) Subject: [Tkinter-discuss] Tkinter question Message-ID: <20061024173142.29349.qmail@web56009.mail.re3.yahoo.com> Thanks for everybody's advice, on both forums (tkinter-discuss & python-list). I end up using Fredrik's Lundh solution, since, in my project, multiple buttons are using the same callback, and their creation is controlled by the interaction with the user. Thanks again, Sorin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061024/8598e231/attachment.htm From Cameron at phaseit.net Tue Oct 24 17:16:53 2006 From: Cameron at phaseit.net (Cameron Laird) Date: Tue, 24 Oct 2006 15:16:53 +0000 Subject: [Tkinter-discuss] question on tab window In-Reply-To: References: Message-ID: <20061024151653.GA4809@lairds.us> On Tue, Oct 24, 2006 at 02:40:38PM +0000, V H wrote: . . . > Does Tkinter offer some simple solution for creating tab windows? Some > examples? . . . "tab" makes me think that the so-called "notebook" widget might interest you: . From fredrik at pythonware.com Tue Oct 24 19:53:24 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 24 Oct 2006 19:53:24 +0200 Subject: [Tkinter-discuss] updated article: a controller class for Tkinter Message-ID: in case someone on this list is interested in an easier way to implement interactive tools for Tkinter applications, here's a short article about pluggable controllers in Tkinter: http://effbot.org/zone/tkcontroller.htm the code can also be downloaded from a subversion repository: http://svn.effbot.python-hosting.com/stuff/sandbox/tkinter enjoy /F From Vasilis.Vlachoudis at cern.ch Fri Oct 27 12:19:20 2006 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Fri, 27 Oct 2006 12:19:20 +0200 Subject: [Tkinter-discuss] Strange Tkinter bug... Message-ID: <4541DD28.3060905@cern.ch> Dear All, I am writting an application using Tkinter and I have the following (annoying problem). I have a class to display randomly tips when the program starts. It shows a dialog with a lamp image on the left and a text message on the right with the tip, and I am selecting randomly a tip from the database. If I use the "import random" in the class to select with tip = random.randint(0,len(TipDialog.tips)-1) the random tip, at the exit of the program I get the following messages for all PhotoImages I have loaded: Exception _tkinter.TclError: <_tkinter.TclError instance at 0x2aaaae09b758> in > ignored Exception _tkinter.TclError: <_tkinter.TclError instance at 0x2aaaae09b758> in > ignored Exception _tkinter.TclError: <_tkinter.TclError instance at 0x2aaaae20a6c8> in > ignored Exception _tkinter.TclError: <_tkinter.TclError instance at 0x2aaaae20a6c8> in > ignored ... If I comment out the "#import random" then I am using the 10ths-milliseconds of the time to get a random tip tip = int(time.time()*100)%len(TipDialog.tips) then at the exit I get NO error message at all. There should be some memory leak either on the random or on the PhotoImage? Regards Vasilis -------------- next part -------------- A non-text attachment was scrubbed... Name: Vasilis.Vlachoudis.vcf Type: text/x-vcard Size: 312 bytes Desc: not available Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20061027/03a61032/attachment.vcf From jose at stat.ucla.edu Mon Oct 30 17:42:00 2006 From: jose at stat.ucla.edu (Jose Hales-Garcia) Date: Mon, 30 Oct 2006 08:42:00 -0800 Subject: [Tkinter-discuss] Opening Tkinter widgets in remote displays Message-ID: Sorry if this has been asked already, I couldn't find any documentation about it. We're trying to get Tkinter's widgets to appear on an X11 server running remotely. Is this possible? So far we're only able to open widgets on the local console. Thank you for your time, Jose From gerardo at computo-industrial.com.mx Mon Oct 30 18:29:55 2006 From: gerardo at computo-industrial.com.mx (Gerardo Juarez) Date: Mon, 30 Oct 2006 12:29:55 -0500 (EST) Subject: [Tkinter-discuss] Opening Tkinter widgets in remote displays In-Reply-To: Message-ID: Hola Jose, As far as I know, there is nothing non-standard in Tkinter or the underlying Tk library with respect to X11. Any application written for X11 should display if there is an X server available. What usually happens is that the application/originating host do not have the authorization to display. This should be within your control, if you have administrative authorization on the target machine. A different story would be if there is some sort of filtering that disallows X messages. A site which only accepts httpd and ssh traffic would be an example. saludos Gerardo On Mon, 30 Oct 2006, Jose Hales-Garcia wrote: > > Sorry if this has been asked already, I couldn't find any > documentation about it. > > We're trying to get Tkinter's widgets to appear on an X11 server > running remotely. Is this possible? > > So far we're only able to open widgets on the local console. > > Thank you for your time, > Jose > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > From fredrik at pythonware.com Mon Oct 30 18:54:29 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 30 Oct 2006 18:54:29 +0100 Subject: [Tkinter-discuss] Opening Tkinter widgets in remote displays In-Reply-To: References: Message-ID: Jose Hales-Garcia wrote: > Sorry if this has been asked already, I couldn't find any > documentation about it. > > We're trying to get Tkinter's widgets to appear on an X11 server > running remotely. Is this possible? what platform are you running on? if you're using Unix, Tkinter is an X11 client application; just set DISPLAY to the right thing and run your program as usual. From chris at niekel.net Mon Oct 30 19:15:02 2006 From: chris at niekel.net (Chris Niekel) Date: Mon, 30 Oct 2006 19:15:02 +0100 Subject: [Tkinter-discuss] Opening Tkinter widgets in remote displays In-Reply-To: References: Message-ID: <20061030181502.GH6551@kira.niekel.net> On Mon, Oct 30, 2006 at 08:42:00AM -0800, Jose Hales-Garcia wrote: > We're trying to get Tkinter's widgets to appear on an X11 server > running remotely. Is this possible? Yes, in the normal way, by setting the DISPLAY environment variable. If you want to do it within the application, you can probably use os.putenv('DISPLAY', 'other:0') before calling Tkinter.Tk() Regards, Chris From jose at stat.ucla.edu Mon Oct 30 20:32:50 2006 From: jose at stat.ucla.edu (Jose Hales-Garcia) Date: Mon, 30 Oct 2006 11:32:50 -0800 Subject: [Tkinter-discuss] Opening Tkinter widgets in remote displays In-Reply-To: References: Message-ID: <5421524E-613A-4677-A6A4-94C2C158CEAE@stat.ucla.edu> On Oct 30, 2006, at 9:54 AM, Fredrik Lundh wrote: > what platform are you running on? I'm running Mac OS X 10.4.8 on both client and server. I've double checked my settings. In SSH I have X11Forwarding turned on. The .Xauthority file contains the correct host information. I can check with the R statistics package that it works. > > if you're using Unix, Tkinter is an X11 client application; just set > DISPLAY to the right thing and run your program as usual. I've tried setting the DISPLAY to the remote server's (from the command line and within Python as suggested) but I get the following error message... kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only INIT_Processeses(), could not establish the default connection to the WindowServer.Abort I'm running the pre-built Mac OS X Python (v2.5). Jose -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061030/6481a8c6/attachment.htm From fredrik at pythonware.com Mon Oct 30 21:22:06 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 30 Oct 2006 21:22:06 +0100 Subject: [Tkinter-discuss] Opening Tkinter widgets in remote displays In-Reply-To: <5421524E-613A-4677-A6A4-94C2C158CEAE@stat.ucla.edu> References: <5421524E-613A-4677-A6A4-94C2C158CEAE@stat.ucla.edu> Message-ID: Jose Hales-Garcia wrote: >> if you're using Unix, Tkinter is an X11 client application; just set >> >> DISPLAY to the right thing and run your program as usual. > > I've tried setting the DISPLAY to the remote server's (from the command > line and within Python as suggested) but I get the following error > message... > > kCGErrorRangeCheck : Window Server communications from outside of > session allowed for root and console user only that error message means exactly what it says: the Mac X server is set up to only accept connections from root and the logged in user. the net is full of people having the same problem with all sorts of apps, but a little googling wasn't enough to reveal a workaround. I suggest checking with your favourite mac os x forum. From gerardo at computo-industrial.com.mx Tue Oct 31 15:42:19 2006 From: gerardo at computo-industrial.com.mx (Gerardo Juarez) Date: Tue, 31 Oct 2006 09:42:19 -0500 (EST) Subject: [Tkinter-discuss] Opening Tkinter widgets in remote displays In-Reply-To: <5421524E-613A-4677-A6A4-94C2C158CEAE@stat.ucla.edu> Message-ID: Are permissions handled the same as Unix on OS X? I remember you had to do something using the xhost command. Check if this is so. Another possibility is the configuration of the graphic server, which I don't know to what extent is compatible with X11. Gerardo On Mon, 30 Oct 2006, Jose Hales-Garcia wrote: > > On Oct 30, 2006, at 9:54 AM, Fredrik Lundh wrote: > > > what platform are you running on? > > I'm running Mac OS X 10.4.8 on both client and server. > > I've double checked my settings. In SSH I have X11Forwarding turned > on. The .Xauthority file contains the correct host information. I > can check with the R statistics package that it works. >