473,695 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tkinter - Screen Resolution

Hi,
I have developed a GUI using tkinter (grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxe s). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger

I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(befor e I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.
A smaller version of my GUI layout looks something like-->

=============== Top Frame========== =======
= - SubFrame - ---------SubFrame---------
= - - -
''''''''''''''' ''''''''''''''' '''
-
= - - - ' Widget ' -
= - - -
''''''''''''''' ''''''''''''''' ''' -
= - Widget - -----------------------------
= -
-
= - - ---------SubFrame---------
= - - -
-
= - - -
''''''''''''''' ''''''''''''''' '''
-
= - Widget - - ' Widget ' -
= - - -
''''''''''''''' ''''''''''''''' ''' -
= - - -
-
= - - -
''''''''''''''' ''''''''''''''' '''
-
= - - - ' Widget ' -
= - Widget - - ''''''''''''''' ''''''''''''''' '''
-
= --------------- -----------------------------
=============== =============== ===========
Thanks
Rahul

May 9 '07 #1
3 6666
On May 9, 10:37 am, rahulna...@yaho o.com wrote:
Hi,
I have developed a GUI using tkinter (grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxe s). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger

I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(befor e I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.
A smaller version of my GUI layout looks something like-->

=============== Top Frame========== =======
= - SubFrame - ---------SubFrame---------
= - - - ''''''''''''''' ''''''''''''''' ''' -
= - - - ' Widget ' -
= - - - ''''''''''''''' ''''''''''''''' ''' -
= - Widget - -----------------------------
= - -
= - - ---------SubFrame---------
= - - - -
= - - - ''''''''''''''' ''''''''''''''' ''' -
= - Widget - - ' Widget ' -
= - - - ''''''''''''''' ''''''''''''''' ''' -
= - - - -
= - - - ''''''''''''''' ''''''''''''''' ''' -
= - - - ' Widget ' -
= - Widget - - ''''''''''''''' ''''''''''''''' ''' -
= --------------- -----------------------------
=============== =============== ===========

Thanks
Rahul

May 9 '07 #2
On Wed, 09 May 2007 18:37:32 +0200, <ra********@yah oo.comwrote:
Hi,
I have developed a GUI using tkinter (grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxe s). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger

I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(befor e I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.
[snip]

For some reason, tk uses different default units for coordinates and font
sizes: a coordinate specified as just a number is considered to be in
pixels (a.k.a screen points); a font size specified as just a number is
considered to be in points, i.e 1/72 inch. So these units are the same
only if your screen resolution is exactly 72 dpi, which is usually not the
case.

If this is actually your problem, the way to correct it is quite simple:
the tk command "tk scaling 1" tells tk that a point and a pixel are the
same thing. To issue it, you may have to use explicitely the tcl
interpreter used by Tkinter by doing:
aWidget.tk.call ('tk', 'scaling', 1)
where aWidget is any Tkinter widget. This is what I had to do with Python
2.1; it may be easier with later Python/Tkinter versions.

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz 5(17l8(%,5.Z*(9 3-965$l7+-'])"
May 10 '07 #3
On May 10, 1:29 am, "Eric Brunel" <eric.bru...@pr agmadev.comwrot e:
On Wed, 09 May 2007 18:37:32 +0200, <rahulna...@yah oo.comwrote:
Hi,
I have developed a GUI usingtkinter(gr id geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxe s). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger
I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(befor e I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.

[snip]

For some reason, tk uses different default units for coordinates and font
sizes: a coordinate specified as just a number is considered to be in
pixels (a.k.a screen points); a font size specified as just a number is
considered to be in points, i.e 1/72 inch. So these units are the same
only if your screen resolution is exactly 72 dpi, which is usually not the
case.

If this is actually your problem, the way to correct it is quite simple:
the tk command "tk scaling 1" tells tk that a point and a pixel are the
same thing. To issue it, you may have to use explicitely the tcl
interpreter used byTkinterby doing:
aWidget.tk.call ('tk', 'scaling', 1)
where aWidget is anyTkinterwidge t. This is what I had to do with Python
2.1; it may be easier with later Python/Tkinterversions .

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz 5(17l8(%,5.Z*(9 3-965$l7+-'])"

This is just what I watned...Thanks that works great -Rahul

May 10 '07 #4

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

Similar topics

1
11061
by: ZaGras | last post by:
when my vb program run on another computer instead of my computer, the user interface is biggger..this is because of the screen resolution... anyone know how to solve pls?
5
4405
by: Chris | last post by:
After exhausting my search on the MS website, I can't find a straight answer. I fin dit hard to believe that MS left our something so useful in ASP.NET as screen resolution detection. Problem: I would like to detect, get values for, the screen resolution in px but in a code behind. Is this possible? There is a System.Windows.Forms.Screen class for the Windows client side, why are there none for browser/ASP.NET client?
4
15512
by: pjac | last post by:
I need some help with some VB language that will change the screen resolution on a monitor when a MS-Access 2000 database is opened from 1024 x 768 to 800 x 600. Any help with this effort would be deeply appreciated. Thanks in advance....
5
6201
by: Maxi | last post by:
I have a 30X16 cells table in my html page. Table height and width are set to 100%. I have set size of every cell inside the table to 24 pixel. When I open the html page in maximize state in either resolution 800 X 600 or 1152 X 864 it takes up the entire explorer size. In screen resolution 800 X 600, if I insert a pictures of 24 X 24 pixel in the cells it takes up the entire cell size (ideally it should as the cell size is also 24 X...
5
2595
by: Pat | last post by:
I am trying to place a dialog in the center of the screen based on a users screen resolution. I can get the width and height of the screen, but I can't seem to use the following: root.geometry('WxH+X+Y') It appears the values for X and Y need to be integers and not a variable like width/2-40 S
9
3901
by: Steve Wright | last post by:
Hi I'm developing a webpage that needs to include a different stylesheet depending on the screen resolution. I know that I could read the resolution in javascript and then do some sort of stylesheet switcher as part of the onload event but I would rather link in the correct stylesheet for the resolution in the first place.
3
3515
by: akbar | last post by:
I googled and searched in archive. All I can find is finding resolution with Tkinter and pygame. Any idea to find monitor resolution with standard python module? I can check from output of: xprop -root _NET_DESKTOP_GEOMETRY(CARDINAL) . The problem is when you use Beryl or Xgl, it is not correct anymore because Beryl or Xgl set this value from amount of workspaces multiplied by monitor or screen resolution.
1
2502
by: nasima khan | last post by:
Hi, i am nasima. I have got a code for setting the screen resolution of my page, but i am unable to understand. Can any one give a complete data explanation of the below code. Sub ChangeRes(X As Long, Y As Long, Bits As Long) Dim DevM As DEVMODE, ScInfo As Long, erg As Long, an As VbMsgBoxResult 'Get the info into DevM erg = EnumDisplaySettings(0&, 0&, DevM) 'This is what we're going to change DevM.dmFields =...
3
3319
by: Thomas Morton | last post by:
This is a "thing" that has been annoying me all morning: and I can't work out how to do it. I need a way to get the DPI or screen resolution of the monitor that a script is currently runnign on. I have a way in Windows but it doesnt port to Unix (which is important). Any ideas?
0
8565
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9113
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...
0
8977
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8839
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
7656
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6488
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
4339
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...
0
4577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1971
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.