From samusrao at gmail.com Sun Aug 7 05:40:52 2016 From: samusrao at gmail.com (Samus Rao) Date: Sun, 07 Aug 2016 19:40:52 +1000 Subject: [Tkinter-discuss] Trying to contact the copyright holder of some code Message-ID: <1470562852.5511.15.camel@gmail.com> Hi! I've been trying to contact Ron Longo, who formerly used this forum, but have thus far been unable to locate current contact details. Could anybody help me with this? He is the copyright holder on some code (http://tkinter.unpythonic.net/ wiki/StyledText) which I have been hoping to tinker with. However, no licence has been provided for it. I am hoping to clear up this point, so that I don't end up leaving code to rot on my hard drive forever. Thanks in advance, Samus From Vasilis.Vlachoudis at cern.ch Wed Aug 24 09:01:01 2016 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Wed, 24 Aug 2016 13:01:01 +0000 Subject: [Tkinter-discuss] Dialog as transient above current toplevel Message-ID: <0BC70B5D93E054469872FFD0FE07220E01831FFC88@CERNXCHG53.cern.ch> Dear all, in my program I want to provide a more understandable text in the simple dialogs for exiting the program if there is modified buffer and some other messages. Instead of creating one dialog for each I use the tkinter dialog Dialog.py like import Dialog ... ans = Dialog.Dialog(self.winfo_toplevel(), {"title":"Multiple Plot", "text":"Continue with the next\nOr do all plots", "bitmap": Dialog.DIALOG_ICON, "default": 0, "strings": ("Next","All","Cancel")}) if ans.num==1: doall = True elif ans.num==2: break However the displayed dialog is centred over the desktop and not above the running application, which is rather confusing. Is there a way to center it over my toplevel window? Thanks in advance Vasilis From klappnase at web.de Wed Aug 24 18:54:35 2016 From: klappnase at web.de (Michael Lange) Date: Thu, 25 Aug 2016 00:54:35 +0200 Subject: [Tkinter-discuss] Dialog as transient above current toplevel In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E01831FFC88@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E01831FFC88@CERNXCHG53.cern.ch> Message-ID: <20160825005435.febfe4f9976a0f3221863868@web.de> Hi, On Wed, 24 Aug 2016 13:01:01 +0000 Vasilis Vlachoudis wrote: > However the displayed dialog is centred over the desktop and not above > the running application, which is rather confusing. > Is there a way to center it over my toplevel window? unfortunately this geometry is hard-coded into Tk, so the answer is "no". You might want to try the tkSimpleDialog.Dialog class instead, by default these dialogs are placed somewhere into the upper left corner of the parent, however you would have to set up a messagebox-like dialog yourself, there is no convenience function for message boxes included. If using pmw is an option for you, you might also try the Pmw.Dialog , iirc there's an option to center the dialog onto its parent. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Madness has no purpose. Or reason. But it may have a goal. -- Spock, "The Alternative Factor", stardate 3088.7 From Vasilis.Vlachoudis at cern.ch Thu Aug 25 10:51:43 2016 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 25 Aug 2016 14:51:43 +0000 Subject: [Tkinter-discuss] Dialog as transient above current toplevel In-Reply-To: <20160825005435.febfe4f9976a0f3221863868@web.de> References: <0BC70B5D93E054469872FFD0FE07220E01831FFC88@CERNXCHG53.cern.ch>, <20160825005435.febfe4f9976a0f3221863868@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0183202FF7@CERNXCHG53.cern.ch> Thanks! I was looking the code dialog.tcl and normally it should work since there is a "transient" command. I don't understand why it doesn't work. I've noticed that some times the transient() doesn't work if it is not placed very close the creation of the Toplevel. Anyhow I decide to replicate the dialog with python and here is the result if it can be useful for anyone. The only thing I didn't manage to make it work properly is the option_add() Also I've noticed that the "grid_anchor()" which is supposed to be present from tk 8.5 it is not accepted as a python command, so I am calling it from tk. class Dialog(Toplevel): def __init__(self, master=None, cnf={}, **kw): Toplevel.__init__(self, master, class_="Dialog", **kw) self.transient(master) self.title(cnf["title"]) self.iconname("Dialog") self.protocol("WM_DELETE_WINDOW", self.close) self.num = cnf["default"] cnf = _cnfmerge((cnf, kw)) # Fill the top part with bitmap and message (use the option # database for -wraplength and -font so that they can be # overridden by the caller). #self.option_add("*Dialog.msg.wrapLength","3i","widgetDefault") #self.option_add("*Dialog.msg.font","TkCaptionFont","widgetDefault") fbot = Frame(self, relief=RAISED, bd=1) ftop = Frame(self, relief=RAISED, bd=1) fbot.pack(side=BOTTOM, fill=BOTH) ftop.pack(side=TOP, fill=BOTH, expand=YES) self.tk.call("grid", "anchor", fbot._w, CENTER) #self.grid_anchor(CENTER) l = Label(ftop, text=cnf["text"], wraplength="3i", font="TkCaptionFont", justify=LEFT) l.pack(side=RIGHT, fill=BOTH, expand=YES, padx="3m", pady="3m") if cnf["bitmap"]: l = Label(ftop, bitmap=cnf["bitmap"]) l.pack(side=LEFT, padx="3m", pady="3m") # Create a row of buttons at the bottom of the dialog for i,s in enumerate(cnf["strings"]): b = Button(fbot, text=s, command=lambda s=self,n=i:s.close(n)) b.bind("", lambda e : e.widget.invoke()) if i==cnf["default"]: b.config(default="active") b.focus_set() else: b.config(default="normal") b.grid(column=i, row=0, sticky=EW, padx=10, pady=4) self.bind("", lambda e,s=self:s.close()) self.bind("", lambda e : e.widget.event_generate("")) self.bind("", lambda e : e.widget.event_generate("")) self.deiconify() self.wait_visibility() self.grab_set() self.focus_set() self.wait_window() #----------------------------------------------------------------------- def close(self, num=-1): self.num = num self.destroy() ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Thursday, August 25, 2016 00:54 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Dialog as transient above current toplevel Hi, On Wed, 24 Aug 2016 13:01:01 +0000 Vasilis Vlachoudis wrote: > However the displayed dialog is centred over the desktop and not above > the running application, which is rather confusing. > Is there a way to center it over my toplevel window? unfortunately this geometry is hard-coded into Tk, so the answer is "no". You might want to try the tkSimpleDialog.Dialog class instead, by default these dialogs are placed somewhere into the upper left corner of the parent, however you would have to set up a messagebox-like dialog yourself, there is no convenience function for message boxes included. If using pmw is an option for you, you might also try the Pmw.Dialog , iirc there's an option to center the dialog onto its parent. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Madness has no purpose. Or reason. But it may have a goal. -- Spock, "The Alternative Factor", stardate 3088.7 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Fri Aug 26 18:51:10 2016 From: klappnase at web.de (Michael Lange) Date: Sat, 27 Aug 2016 00:51:10 +0200 Subject: [Tkinter-discuss] Dialog as transient above current toplevel In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0183202FF7@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E01831FFC88@CERNXCHG53.cern.ch> <20160825005435.febfe4f9976a0f3221863868@web.de> <0BC70B5D93E054469872FFD0FE07220E0183202FF7@CERNXCHG53.cern.ch> Message-ID: <20160827005110.a6cd10b1630124ea62cc4b77@web.de> Hi, On Thu, 25 Aug 2016 14:51:43 +0000 Vasilis Vlachoudis wrote: > Thanks! I was looking the code dialog.tcl and normally it should work > since there is a "transient" command. I don't understand why it doesn't > work. "Transient" means here, that the window is always above its parent in the WM's stacking order. You can see this when you open such a dialog box and move it over the parent (if it's not already there) and then click into the parent window: the transient dialog will nontheless stay on top. This however has nothing to do with the coordinates where the window is placed on the screen. The relevant part for the latter in dialog.tcl is this, most interesting the comments (here at line 148): # 6. Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w tkwait visibility $w Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Many Myths are based on truth -- Spock, "The Way to Eden", stardate 5832.3 From hayden.ravenscroft at hotmail.com Sat Aug 27 08:17:55 2016 From: hayden.ravenscroft at hotmail.com (Hayden Ravenscroft) Date: Sat, 27 Aug 2016 12:17:55 +0000 Subject: [Tkinter-discuss] CMD in Tkinter (Python 3) Message-ID: Hi all, I'm attempting to write an IDE for python, in python. My major problem is embedding a console on a tkinter frame so the IDE can run the user's script. I have browsed through many solutions, but they are mostly for Python 2 only (and no, converting them did not work). I looked at this: http://stackoverflow.com/questions/7253448/how-to-embed-a-terminal-in-a-tkinter-application But xterm only works with Linux - is there a windows solution? Thanks, Hayden -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw at codebykevin.com Sun Aug 28 11:09:28 2016 From: kw at codebykevin.com (Kevin Walzer) Date: Sun, 28 Aug 2016 11:09:28 -0400 Subject: [Tkinter-discuss] CMD in Tkinter (Python 3) In-Reply-To: References: Message-ID: <28913E86-6E0B-4F46-8EF5-C6951415A0C6@codebykevin.com> Idlelib might provide some useful code. Lots of projects use it to embed a console. > On Aug 27, 2016, at 8:17 AM, Hayden Ravenscroft wrote: > > Hi all, > > I?m attempting to write an IDE for python, in python. My major problem is embedding a console on a tkinter frame so the IDE can run the user?s script. I have browsed through many solutions, but they are mostly for Python 2 only (and no, converting them did not work). I looked at this: > http://stackoverflow.com/questions/7253448/how-to-embed-a-terminal-in-a-tkinter-application > But xterm only works with Linux ? is there a windows solution? > > Thanks, > Hayden > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From aivar.annamaa at gmail.com Sun Aug 28 15:43:04 2016 From: aivar.annamaa at gmail.com (Aivar Annamaa) Date: Sun, 28 Aug 2016 22:43:04 +0300 Subject: [Tkinter-discuss] CMD in Tkinter (Python 3) In-Reply-To: References: Message-ID: Hi! You could take a look how it was done in Thonny (http://thonny.cs.ut.ee/) https://bitbucket.org/plas/thonny/src/master/thonny/shell.py?at=master&fileviewer=file-view-default Let me know if you need more explanations. Best regards, Aivar On Sat, Aug 27, 2016 at 3:17 PM, Hayden Ravenscroft < hayden.ravenscroft at hotmail.com> wrote: > Hi all, > > > > I?m attempting to write an IDE for python, in python. My major problem is > embedding a console on a tkinter frame so the IDE can run the user?s > script. I have browsed through many solutions, but they are mostly for > Python 2 only (and no, converting them did not work). I looked at this: > > http://stackoverflow.com/questions/7253448/how-to- > embed-a-terminal-in-a-tkinter-application > > But xterm only works with Linux ? is there a windows solution? > > > > Thanks, > > Hayden > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: