473,656 Members | 2,777 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 3601
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.w m_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.a fter_idle(cente rPopupWindow)

with:

def centerPopupWind ow():
x, y = editorWindow.wi nfo_rootx(), editorWindow.wi nfo_rooty()
w, h = editorWindow.wi nfo_width(), editorWindow.wi nfo_height()
ww, hh = myPopupWindow.w info_width(), myPopupWindow.w info_height()
myPopupWindow.g eometry('%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.u pdate_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.zmz 5(17l8(%,5.Z*(9 3-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.w m_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.a fter_idle(cente rPopupWindow)

with:

def centerPopupWind ow():
x, y = editorWindow.wi nfo_rootx(), editorWindow.wi nfo_rooty()
w, h = editorWindow.wi nfo_width(), editorWindow.wi nfo_height()
ww, hh = myPopupWindow.w info_width(), myPopupWindow.w info_height()
myPopupWindow.g eometry('%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.u pdate_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.zmz 5(17l8(%,5.Z*(9 3-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
3066
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 the context of a main window. The problem does not occur on HPUX or Linux. The following simple example code illustrates the problem and the work around I've come up with; However, I'd like, very much, to get rid of the kludgy work around....
3
3331
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 a button labeled "ok". The second window is supposed to be modal - it should not be possible to reset the focus back to the first window or close the first window without first closing the second. The program works just fine in Windows XP...
0
1424
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 be def hidepopup(event=None): popup.unpost() return "break"
5
42478
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 have. Please help.
0
1944
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 displaying the list of items in the menu does not expand. This is the object I'm talking about: <code>
1
2494
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: def showmsg(self, event):
2
2838
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 don't mean a drop-down or a pop-up menu, but those options which yield to another batch of sub-options when scrolled over, (as for example, the File->New option from internet explorer).
4
2193
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: ----------- from Tkinter imprt * root = Tk() L = Label(root, text="Blah")
6
13902
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 Windows (any flavour) the tkMessagebox brings up over the underlying window. On Linux (apparently any flavour) the tkMessagebox brings up under the underlying window. You can drag the popup window near the main window to discover if it's
1
2811
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 to the callback function? Here's a short example script: from Tkinter import * root = Tk() def colour():
0
8382
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8498
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8600
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.