[Tkinter-discuss] Need help on gui focus l

Cam Farnell msa01 at bitflipper.ca
Thu Oct 15 11:15:30 CEST 2009


The behavior of your tcl script is identical to the Python code so it's not Python causing the problem. I'm running Ubuntu 8.04 (Hardy), Python 2.5.2 and I don't know enough about tcl to find out its version. The file /usr/share/doc/tk8.4/README says it is 8.4.16.

Cam

Michael Lange wrote:
> Hi,
> 
> On Wed, 14 Oct 2009 17:07:30 -0300
> Cam Farnell <msa01 at bitflipper.ca> wrote:
> 
>> The code given exhibits the problem on my Ubuntu Linux box. For the
>> sake of clarity I enumerate three windows involved in this code:
>>
>> - The MAIN window which has a button marked "popup" in it.
>> - The CHILD windows which has a button marked "filedialog" in it.
>> - The OPEN window which is the tkFileDialog
>>
>> On my machine clicking on the "popup" and "filedialog" buttons works
>> ok, but once you select a file and click OPEN, then what is on top
>> and visible is the MAIN window whereas what the original poster
>> wanted was to see the CHILD window. Even worse, if (starting from
>> scratch again) you click the "popup" button, then drag the resulting
>> CHILD window to a slightly new position then click the "filedialog"
>> button, the OPEN window appears *under* the CHILD window which seems
>> less than useful.
>>
> 
> You are right, this actually sounds less than useful and it is surely
> not the way it is supposed to be. I cannot reproduce this here (debian
> lenny, Python-2.5.2, Tk-8.4.19) though. I guess this is most likely a
> bug in your version of Tk.
> I wrote a tiny tcl script that does basically the same as the python
> code from my last post, you can try if it exhibits the same bug, then
> we could at least be sure that it's not python that causes the bug.
> 
> ###CODE###
>  #!/usr/bin/env wish
> 
> toplevel .t
> wm withdraw .t
> wm protocol .t WM_DELETE_WINDOW {wm withdraw .t}
> button .t.b0 -text "filedialog" -command tk_getOpenFile
> pack .t.b0 -padx 100 -pady 100
> button .b1 -text "popup" -command {wm deiconify .t}
> pack .b1 -padx 100 -pady 100
> ###CODE###
> 
> Michael


More information about the Tkinter-discuss mailing list