473,503 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tkinter popup

Hi all

I cant figure out how to disable resizing of my popup window?
How to put this popup window to show in the middle of my text editor?
It is writen with Toplevel.
thx
Mar 27 '07 #1
2 3597
On Tue, 27 Mar 2007 12:05:07 +0200, Gigs_ <gi**@hi.t-com.hrwrote:
Hi all

I cant figure out how to disable resizing of my popup window?
myPopupWindow.wm_resizable(0, 0)

It may or may not make resize controls disappear depending on your
platform and/or window manager. But the resizing will be impossible in any
case.
How to put this popup window to show in the middle of my text editor?
It is writen with Toplevel.
A bit trickier. For example (untested):

myPopupWindow.after_idle(centerPopupWindow)

with:

def centerPopupWindow():
x, y = editorWindow.winfo_rootx(), editorWindow.winfo_rooty()
w, h = editorWindow.winfo_width(), editorWindow.winfo_height()
ww, hh = myPopupWindow.winfo_width(), myPopupWindow.winfo_height()
myPopupWindow.geometry('%sx%s+%s+%s', ww, hh, x + w/2 - ww/2, y + h/2-
hh/2)

The after_idle trick is needed since the dimensions for the popup window
will only be known when the window is actually displayed. In theory,
myPopupWindow.update_idletasks() should update the display so that the
window dimensions are known, but there are cases where it doesn't work. So
the after_idle trick is surer.

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"
Mar 27 '07 #2
Eric Brunel wrote:
On Tue, 27 Mar 2007 12:05:07 +0200, Gigs_ <gi**@hi.t-com.hrwrote:
>Hi all

I cant figure out how to disable resizing of my popup window?

myPopupWindow.wm_resizable(0, 0)

It may or may not make resize controls disappear depending on your
platform and/or window manager. But the resizing will be impossible in
any case.
>How to put this popup window to show in the middle of my text editor?
It is writen with Toplevel.

A bit trickier. For example (untested):

myPopupWindow.after_idle(centerPopupWindow)

with:

def centerPopupWindow():
x, y = editorWindow.winfo_rootx(), editorWindow.winfo_rooty()
w, h = editorWindow.winfo_width(), editorWindow.winfo_height()
ww, hh = myPopupWindow.winfo_width(), myPopupWindow.winfo_height()
myPopupWindow.geometry('%sx%s+%s+%s', ww, hh, x + w/2 - ww/2, y + h/2
- hh/2)

The after_idle trick is needed since the dimensions for the popup window
will only be known when the window is actually displayed. In theory,
myPopupWindow.update_idletasks() should update the display so that the
window dimensions are known, but there are cases where it doesn't work.
So the after_idle trick is surer.

HTH
--python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"
thanks for both replay, they are very helpful. specially this one, it
will took some times for me to figure this. i was completely forgot that
this can be done like that

thx
Mar 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3046
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
3
3305
by: DoubleM | last post by:
Hi, I'm running Python2.3.3c1 on Mandrake 9.1 The following code is designed to bring up a window with a button labeled "popup". Clicking on the popup buttons triggers a secondary window with...
0
1406
by: Peter Otten | last post by:
How can I close a popup menu in Tkinter by clicking elsewhere on the toplevel window underneath? I tried popup.grab_set() but this causes the popup to close immediately. An alternative would...
5
42471
by: Ali | last post by:
When I open a window using the Tkinter GUI thing the title bar always says "Tk". I would like to know how to change this. I would also like to know how to cjange it on any other popup windows I may...
0
1927
by: mariox19 | last post by:
Hello, The Tkinter OptionMenu widget has me a bit confused. I have set up an OptionMenu to expand along the X axis as the window expands. What I find though is that the width of the submenu...
1
2487
by: Harlin Seritt | last post by:
I am working on making something called a PopMsg widget which is actually identical to a Balloon widget from Pmw. Here is the code: ---code--- from Tkinter import * import time class PopMsg:...
2
2825
by: ishtar2020 | last post by:
Hi everybody I'd appreciate some help on creating a tear off menu with TkInter. I've been reading some documentation but still no luck. Please don't get confused: when I mean "tear off" menu I...
4
2183
by: greenflame | last post by:
I have a script that will make a window that shows the text I want using Tkinter. What I need to do is to make another window popup above the current window showing other text. I tryed: ...
6
13884
by: marcoberi | last post by:
Hi everybody. I have this code snippet that shows a window without a titlebar (using overrideredirect) and two buttons on it: one quits and the other one brings up a simple tkMessageBox. On...
1
2803
by: nihilium | last post by:
With a right click, a popup menu will appear, allowing to select from a list of colours. The queston is: is it necessary to create a callback function for each colour? How may I pass on information...
0
7280
Oralloy
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,...
0
7330
jinu1996
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...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.