From mateusz at loskot.net Tue Oct 8 18:01:49 2013 From: mateusz at loskot.net (Mateusz Loskot) Date: Tue, 8 Oct 2013 17:01:49 +0100 Subject: [Tkinter-discuss] A non-blocking way to display a window? Message-ID: Hi, I'm trying to replicate a non-blocking (or modeless) window behaviour from a Windows .NET application using Tkinter. The application I've got shows a new window in response to some event (might be non-GUI event) and the execution continues leaving the new window displayed. Here is the relevant code: private void foo(object sender, EventArgs e) { Form1 f = new Form1(); f.Show(); // displays a window and continues Console.WriteLine("Form created"); } The important bit is call to the Show() method [1] of .NET class System.Windows.Forms.Form. The foo() function may be called from a non-GUI application, as response to some signal or even invoked from a C++ application. The point is there is no explicit waiting for events and the window is modeless. How can I achieve similar behaviour in Tkinter? How to avoid calling mainloop() or wait_window() methods, which both are blocking? [1] http://msdn.microsoft.com/en-us/library/system.windows.forms.control.show.aspx Best regards, -- Mateusz Loskot, http://mateusz.loskot.net From mateusz at loskot.net Thu Oct 10 23:10:45 2013 From: mateusz at loskot.net (Mateusz Loskot) Date: Thu, 10 Oct 2013 22:10:45 +0100 Subject: [Tkinter-discuss] How to set window's master from HWND on Windows? Message-ID: Hi, I'm using Tkinter in embedded Python interpreter on Windows. There is a desktop Win32 application with a main window opened. The embedded Python runs a script which creates and displays a Tkinter window. Is there any way to assign master (parent) of Tkinter window based on HWND of a Win32 window? I'd like to make the Tkinter window a fully modal window in regard to the main Win32 application window. I know the winfo_* APIs wiht winfo_id() which allows me to query Win32 HWND of Tkinter window, but there seems to be no similar function to set parent by HWND (or id on non-Windows OS). Is there any Tkinter idiomatic workaround for such problem? One of ideas I've got is to create a small Python extension, available from my embedded Python, with exposed custom function to overwrite HWND of Tkinter windows's parent, using the Win32 SetParent [1]. Here is some sort of a pseudo-code of the idea: PyObject * mywin32_set_parent(PyObject *self, PyObject *args) { /* unpack Tkinter HWND from args */ HWND hTkinterWindow = ... ; /* returns main application window */ HWND hAppWindow = GetMyAppWindow(); /* make the main window parent of the Tkinter */ ::SetParent(hTkinterWindow, hAppWindow) Py_INCREF(Py_None); return Py_None; } and then in Python script code executed by the embedded Python: import mywin32 root = Tk() hwnd = root.winfo_id() # make root a child of the main application window overwriting its parent mywin32.set_parent(hwnd) I'd appreciate any comments and critique. [1] http://msdn.microsoft.com/en-us/library/windows/desktop/ms633541.aspx Best regards, -- Mateusz Loskot, http://mateusz.loskot.net From zaazbb at 163.com Wed Oct 23 05:02:59 2013 From: zaazbb at 163.com (zaazbb) Date: Wed, 23 Oct 2013 11:02:59 +0800 Subject: [Tkinter-discuss] How to define a widget name in a file but create it in another file?? Message-ID: <3f765e01.1dd5.141e344048d.Coremail.zaazbb@163.com> In the Tk demo, you can define a widget name in a subscript file, but create this widget in the main srcipt file. How to do it in python/tkinter? here is the Tk code, buttons named in sub file, but create in main file: in subscript file: ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w {} \ {ttk::button $w.buttons.fontchooser -command fontchooserToggle}] pack $btns -side bottom -fill x in main script file: proc addSeeDismiss {w show {vars {}} {extra {}}} { ## See Code / Dismiss buttons ttk::frame $w ttk::separator $w.sep #ttk::frame $w.sep -height 2 -relief sunken ... } 2013-10-23 zaazbb -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Wed Oct 23 12:44:48 2013 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Wed, 23 Oct 2013 12:44:48 +0200 Subject: [Tkinter-discuss] Idle bug under MacOSX Maverick Message-ID: Dear all, not sure this is the right place to send this, but can't find an email list for Idle. Installed OSX 10.9 (Maverick) this morning, and then opened Idle (as packaged with Python 3.4.0 alpha 4 from the python.org release). I can do most everything, except when I click on my code to change the insert pointer location, it doesn't move from the old position. Well, to make things worse, once in ten clicks it will follow. Sometimes, especially when i click beyond the last char on a line, the insert mark disappears entirely. Anyone seen anything similar? Anyone run Idle under Maverick without this problem? Mick From rowen at uw.edu Wed Oct 23 20:09:55 2013 From: rowen at uw.edu (Russell E. Owen) Date: Wed, 23 Oct 2013 11:09:55 -0700 Subject: [Tkinter-discuss] Idle bug under MacOSX Maverick References: Message-ID: In article , "Michael O'Donnell" wrote: > Dear all, > > not sure this is the right place to send this, but > can't find an email list for Idle. > > Installed OSX 10.9 (Maverick) this morning, > and then opened Idle (as packaged with > Python 3.4.0 alpha 4 from the python.org release). > > I can do most everything, except when I click on > my code to change the insert pointer location, it doesn't > move from the old position. > > Well, to make things worse, once in ten clicks > it will follow. Sometimes, especially when i click > beyond the last char on a line, the insert mark > disappears entirely. > > Anyone seen anything similar? Anyone > run Idle under Maverick without this problem? > > Mick I have heard one report from a Mavericks user for an application that I distribute, and it's scary. One window takes many seconds to open, and another is unusable because the user cannot type into it. My app uses Tcl/Tk 8.5.11 because later versions crash (due to a bug that I reported to this list, but I've not yet tried to write the pure tcl version -- this Mavericks probably strongly suggest I'd better get on it). -- Russell From nad at acm.org Wed Oct 23 21:40:01 2013 From: nad at acm.org (Ned Deily) Date: Wed, 23 Oct 2013 12:40:01 -0700 Subject: [Tkinter-discuss] Idle bug under MacOSX Maverick References: Message-ID: In article , "Michael O'Donnell" wrote: > Dear all, > > not sure this is the right place to send this, but > can't find an email list for Idle. > > Installed OSX 10.9 (Maverick) this morning, > and then opened Idle (as packaged with > Python 3.4.0 alpha 4 from the python.org release). > > I can do most everything, except when I click on > my code to change the insert pointer location, it doesn't > move from the old position. > > Well, to make things worse, once in ten clicks > it will follow. Sometimes, especially when i click > beyond the last char on a line, the insert mark > disappears entirely. > > Anyone seen anything similar? Anyone > run Idle under Maverick without this problem? This is an OS X 10.9 related problem in Cocoa Tk. It is awaiting further investigation: https://core.tcl.tk/tk/tktview?name=53f7a1b553 http://bugs.activestate.com/show_bug.cgi?id=101210 Note that the display updates when you mouse over the text window scroll bar or type in the window. The simplest workaround for Python 3.x at the moment is to launch IDLE in 32-bit mode, for example: python3.4-32 -m idlelib As noted in the Tk issue above, the Apple-supplied Tk 8.5.9 does not have this problem so it shouldn't be too hard to get this fixed. It is possible to have Python 3.4.x use the system Python but then you run into its known other problems, including immediate crashes when typing a composing character in a text field (for example, on US Extended input methord, opt-u a for a). -- Ned Deily, nad at acm.org From nad at acm.org Wed Oct 23 21:42:11 2013 From: nad at acm.org (Ned Deily) Date: Wed, 23 Oct 2013 12:42:11 -0700 Subject: [Tkinter-discuss] Idle bug under MacOSX Maverick References: Message-ID: P.S. In article , "Michael O'Donnell" wrote: > not sure this is the right place to send this, but > can't find an email list for Idle. https://mail.python.org/mailman/listinfo/idle-dev However, this problem potentially affects any Tkinter apps on 10.9 that have multiple windows. -- Ned Deily, nad at acm.org From kw at codebykevin.com Wed Oct 23 23:11:18 2013 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 23 Oct 2013 17:11:18 -0400 Subject: [Tkinter-discuss] Idle bug under MacOSX Maverick In-Reply-To: References: Message-ID: <52683B76.5030904@codebykevin.com> On 10/23/13 3:40 PM, Ned Deily wrote: > > This is an OS X 10.9 related problem in Cocoa Tk. It is awaiting further > investigation: > > https://core.tcl.tk/tk/tktview?name=53f7a1b553 > > http://bugs.activestate.com/show_bug.cgi?id=101210 > > I'm hoping to install Mavericks this weekend, and I'll take a look at the issue after I do so. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com From rowen at uw.edu Thu Oct 24 21:42:02 2013 From: rowen at uw.edu (Russell E. Owen) Date: Thu, 24 Oct 2013 12:42:02 -0700 Subject: [Tkinter-discuss] Crash when changing fonts Message-ID: (approximate copy of message posted to tcl-mac) I distribute a Mac application based on Tkinter that crashes when a user updates certain preferences that use the option database, including font size and some colors. It works OK with Tcl/Tk 8.5.11, but crashes using 8.5.12, 8.5.12.1, 8.5.13 and 8.1.14. I was finally able to come up with a simple test case in tcl (appended). I opened a ticket at the Tk bug reporter, but I figured I'd also post here, just to spread the word. If anyone can think of a workaround (other than sticking with 8.5.11, which is what I've done so far, but it doesn't work with Mavericks) I'd really appreciate it. So far nothing I've tried works (except not adding entries to the "apple" menu, which would make the Mac version much less Mac-like, or never touching the option database, which removes a useful feature). -- Russell # tcl menu crash; to crash run the code and push the button menu .parentMenu menu .parentMenu.apple -tearoff 0 # the following line is optional, but shows the menu is created .parentMenu.apple add command -label "Something" .parentMenu add cascade -label Wish -menu .parentMenu.apple font create testFont option add "*Button.font" testFont button .btn -text "Change Font" -command { font configure testFont -size 20 } pack .btn . configure -menu .parentMenu In Tkinter this reads as: import Tkinter import tkFont root = Tkinter.Tk() parentMenu = Tkinter.Menu(root) appleMenu = Tkinter.Menu(parentMenu, name="apple", tearoff=0) appleMenu.add_command(label="Something") # may be omitted parentMenu.add_cascade(label="Python", menu=appleMenu) font = tkFont.Font() root.option_add("*Button.font", font) def changeFont(): font.configure(size=20) btn = Tkinter.Button(root, text="Change Font", command=changeFont) btn.pack() root["menu"] = parentMenu root.mainloop() From nad at acm.org Mon Oct 28 09:47:18 2013 From: nad at acm.org (Ned Deily) Date: Mon, 28 Oct 2013 01:47:18 -0700 Subject: [Tkinter-discuss] Idle bug under MacOSX Maverick References: Message-ID: In article , Ned Deily wrote: > In article > , > "Michael O'Donnell" wrote: [...] > > Installed OSX 10.9 (Maverick) this morning, > > and then opened Idle (as packaged with > > Python 3.4.0 alpha 4 from the python.org release). > > > > I can do most everything, except when I click on > > my code to change the insert pointer location, it doesn't > > move from the old position. > > > > Well, to make things worse, once in ten clicks > > it will follow. Sometimes, especially when i click > > beyond the last char on a line, the insert mark > > disappears entirely. > > > > Anyone seen anything similar? Anyone > > run Idle under Maverick without this problem? > > This is an OS X 10.9 related problem in Cocoa Tk. It is awaiting further > investigation: > > https://core.tcl.tk/tk/tktview?name=53f7a1b553 > > http://bugs.activestate.com/show_bug.cgi?id=101210 Update: Kevin Walzer has tracked down the problem and committed a fix for Tk 8.5 which solves the problems seen with Python's IDLE on 10.9. As described in Issue19373, the Python project has just issued maintenance release candidates, 3.3.3rc1 and 2.7.6rc1, for the current Python 3 and 2 releases. The python.org OS X 64-bit binary installers for these releases now include a built-in version of Tcl/Tk 8.5 so that users no longer have to install third-part Tcl/Tk releases to avoid the critical problems in the system Tcl/Tk 8.5 shipped by Apple in recent OS X releases. The fix arrived after the "rc1" installers were created but "rc1_rev1" installers that include this fix should be available on the 3.3.3 and 2.7.6 download pages soon. The fix will also be included in the next pre-release of 3.4.0, expected to be 3.4.0b1. In the meantime, there are things you can do to mitigate the problem on 10.9; as described in Issue19373, the simplest workaround for IDLE is to force it to run in 32-bit mode. http://www.python.org/download/releases/3.3.3/ http://www.python.org/download/releases/2.7.6/ http://bugs.python.org/issue19373 -- Ned Deily, nad at acm.org From michael.odonnell at uam.es Mon Oct 28 09:54:31 2013 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Mon, 28 Oct 2013 09:54:31 +0100 Subject: [Tkinter-discuss] Idle bug under MacOSX Maverick In-Reply-To: References: Message-ID: Further the Maverick-induced bug affecting Tkinter-based apps: For those packaging apps for distribution using py2app, you can force your app to run in 32 bit mode using the following simple line in the terminal: ditto --rsrc --arch i386 YOURAPP.app YOURAPP-32.app/ Mick On 28 October 2013 09:47, Ned Deily wrote: > In article , > Ned Deily wrote: > > In article > > , > > "Michael O'Donnell" wrote: > [...] > > > Installed OSX 10.9 (Maverick) this morning, > > > and then opened Idle (as packaged with > > > Python 3.4.0 alpha 4 from the python.org release). > > > > > > I can do most everything, except when I click on > > > my code to change the insert pointer location, it doesn't > > > move from the old position. > > > > > > Well, to make things worse, once in ten clicks > > > it will follow. Sometimes, especially when i click > > > beyond the last char on a line, the insert mark > > > disappears entirely. > > > > > > Anyone seen anything similar? Anyone > > > run Idle under Maverick without this problem? > > > > This is an OS X 10.9 related problem in Cocoa Tk. It is awaiting further > > investigation: > > > > https://core.tcl.tk/tk/tktview?name=53f7a1b553 > > > > http://bugs.activestate.com/show_bug.cgi?id=101210 > > Update: Kevin Walzer has tracked down the problem and committed a fix for > Tk > 8.5 which solves the problems seen with Python's IDLE on 10.9. > > As described in Issue19373, the Python project has just issued maintenance > release candidates, 3.3.3rc1 and 2.7.6rc1, for the current Python 3 and 2 > releases. The python.org OS X 64-bit binary installers for these > releases now > include a built-in version of Tcl/Tk 8.5 so that users no longer have to > install third-part Tcl/Tk releases to avoid the critical problems in the > system Tcl/Tk 8.5 shipped by Apple in recent OS X releases. The fix > arrived > after the "rc1" installers were created but "rc1_rev1" installers that > include > this fix should be available on the 3.3.3 and 2.7.6 download pages soon. > The > fix will also be included in the next pre-release of 3.4.0, expected to be > 3.4.0b1. In the meantime, there are things you can do to mitigate the > problem > on 10.9; as described in Issue19373, the simplest workaround for IDLE is > to > force it to run in 32-bit mode. > > http://www.python.org/download/releases/3.3.3/ > http://www.python.org/download/releases/2.7.6/ > http://bugs.python.org/issue19373 > > -- > Ned Deily, > nad at acm.org > > _______________________________________________ > 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 rowen at uw.edu Wed Oct 30 19:17:00 2013 From: rowen at uw.edu (Russell E. Owen) Date: Wed, 30 Oct 2013 11:17:00 -0700 Subject: [Tkinter-discuss] Crash when changing fonts References: Message-ID: In article , "Russell E. Owen" wrote: > (approximate copy of message posted to tcl-mac) > > I distribute a Mac application based on Tkinter that crashes when a user > updates certain preferences that use the option database, including font > size and some colors. It works OK with Tcl/Tk 8.5.11, but crashes using > 8.5.12, 8.5.12.1, 8.5.13 and 8.1.14. > > I was finally able to come up with a simple test case in tcl (appended). > I opened a ticket at the Tk bug reporter, but I figured I'd also post > here, just to spread the word. (...see previous posting for code). I just wanted to say that ActiveState Tcl/Tk 8.5.15 still has this bug. (Does anyone know if 8.5.15 contains the fix for Mavericks?). -- Russell From nad at acm.org Wed Oct 30 23:55:40 2013 From: nad at acm.org (Ned Deily) Date: Wed, 30 Oct 2013 15:55:40 -0700 Subject: [Tkinter-discuss] Crash when changing fonts References: Message-ID: In article , "Russell E. Owen" wrote: > In article , > "Russell E. Owen" wrote: > > > (approximate copy of message posted to tcl-mac) > > > > I distribute a Mac application based on Tkinter that crashes when a user > > updates certain preferences that use the option database, including font > > size and some colors. It works OK with Tcl/Tk 8.5.11, but crashes using > > 8.5.12, 8.5.12.1, 8.5.13 and 8.1.14. > > > > I was finally able to come up with a simple test case in tcl (appended). > > I opened a ticket at the Tk bug reporter, but I figured I'd also post > > here, just to spread the word. > > (...see previous posting for code). > > I just wanted to say that ActiveState Tcl/Tk 8.5.15 still has this bug. > (Does anyone know if 8.5.15 contains the fix for Mavericks?). AFAIK, the current A/S 8.5.15.0 does not contain the fix. I believe an update is on its way. -- Ned Deily, nad at acm.org From kw at codebykevin.com Thu Oct 31 00:01:23 2013 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 30 Oct 2013 19:01:23 -0400 Subject: [Tkinter-discuss] Crash when changing fonts In-Reply-To: References: Message-ID: <52718FC3.7040103@codebykevin.com> On 10/30/13, 2:17 PM, Russell E. Owen wrote: > I just wanted to say that ActiveState Tcl/Tk 8.5.15 still has this bug. > (Does anyone know if 8.5.15 contains the fix for Mavericks?). AS hasn't released an update yet for Mavericks AFAIK; they posted links over the weekend for beta testing of the new build. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com