views:

36

answers:

1

I'm experimenting with the new ttk Tile enhancements that ship with Python 2.7.

Windows 7: The code below demonstrates how the combobox dropdown shows up BEHIND our root window when the root window is configured as a topmost window ("always on top"). If you comment out the line """ root.attributes( '-topmost', 1 )""" then the combobox dropdown appears within the root window (as expected).

Anyone have any workarounds for this behavior so we can use comboboxes with 'topmost' windows?

# sample code that illustrates problem described above

import Tkinter as tkinter
import ttk

root = tkinter.Tk()

panelCombo = ttk.Frame( root )
panelCombo.pack( side='top', fill='x', padx=12, pady=8 )
valCombo = ( 'cat', 'dog', 'pig' )
varCombo = tkinter.StringVar()
varCombo.set( 'fish' )
cboCombo = ttk.Combobox( panelCombo, values=valCombo, textvariable=varCombo )
cboCombo.pack( side='left', anchor='w', padx=12, pady=8 )

# make our window 'alwaysontop'
root.attributes( '-topmost', 1 )
root.mainloop()
+1  A: 

That's a known bug in the Tk toolkit. It was fixed in release 8.5.6. Maybe you just need to wait until that release makes its way into Python.

Frédéric Hamidi
Thank you Frédéric. Regards, Malcolm
Malcolm