I'm seeing some new and unexpected behaviour with tkinter + python2.4,
in a gnome+linux environment. The code below used to work (and
continues to work under windows). The intended behaviour is that a
window is created the the first time the button is pushed, and then
de-iconified and brought to the top whenever the button is pushed
again. The behaviour I'm seeing is that the window is de-iconified (if
iconified) correctly, but if already present on the screen, it is not
raised.
Does this code look ok? Any suggestions as to what the problem could
be?
Thanks for any pointers.
--------------------------------------------------
from Tkinter import *
t = None
def cmd():
global t
if t:
t.tkraise()
t.deiconify()
else:
t = Toplevel()
l = Label( t, text=".... some text goes here ..." )
l.pack()
b = Button(text="Raise",command=cmd)
b.pack()
b.mainloop() 1 2222
On 24 Aug 2005 06:57:07 -0700, twd <tw****@dockerz.net> wrote: I'm seeing some new and unexpected behaviour with tkinter + python2.4, in a gnome+linux environment. The code below used to work (and continues to work under windows). The intended behaviour is that a window is created the the first time the button is pushed, and then de-iconified and brought to the top whenever the button is pushed again. The behaviour I'm seeing is that the window is de-iconified (if iconified) correctly, but if already present on the screen, it is not raised.
What exactly do you expect? Do you want to raise the window above all other windows *in your application*, or above *all* other windows? I doubt tk can guarantee the latter, and this seems to be confirmed by the manuel for tk's raise command; cf. http://www.tcl.tk/man/tcl8.4/TkCmd/raise.htm
If you put the window with the button in front of the window with the label, and if pressing the button doesn't bring the window with the lable above the other, then it may be a bug. If it works, I guess it's just a matter of how the window managers interpret what "raising a window" means... But I'm no specialist here, so maybe someone else will confirm that.
[snip] from Tkinter import *
t = None
def cmd(): global t if t: t.tkraise() t.deiconify() else: t = Toplevel() l = Label( t, text=".... some text goes here ..." ) l.pack()
b = Button(text="Raise",command=cmd) b.pack() b.mainloop()
(BTW, did you try to put the deiconify before the tkraise?)
HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Foord |
last post by:
Here's a little oddity with 'print' being a reserved word...
>>> class thing:
pass
>>> something = thing()
>>> something.print = 3
SyntaxError: invalid syntax
>>> print something.__dict__...
|
by: jmdocherty |
last post by:
All,
I've been trying to set up a CSS layout and all seems well in Firefox
but in Safari it just seems to be plain weird! I hope someone can help
tell me whether this is a problem with my code...
|
by: michael.f.ellis |
last post by:
The following script puzzles me. It creates two nested lists that
compare identically. After identical element assignments, the lists
are different. In one case, a single element is replaced. In...
|
by: Rex the Strange |
last post by:
Hello all,
Traditionally I'm a Delphi and VB6 programmer and have recently started
working with VB.NET (which, I might add, I love, but that's beside the
point). Anyway, I was trying to make a...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |