Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   tkinter - Screen Resolution (http://www.velocityreviews.com/forums/t505277-tkinter-screen-resolution.html)

rahulnag22@yahoo.com 05-09-2007 04:37 PM

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,listboxes). 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(before 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


rahulnag22@yahoo.com 05-09-2007 04:42 PM

Re: tkinter - Screen Resolution
 
On May 9, 10:37 am, rahulna...@yahoo.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,listboxes). 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(before 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




Eric Brunel 05-10-2007 07:29 AM

Re: tkinter - Screen Resolution
 
On Wed, 09 May 2007 18:37:32 +0200, <rahulnag22@yahoo.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,listboxes). 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(before 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.zmz5(17l8(%,5.Z*(93-965$l7+-'])"

rahulnag22@yahoo.com 05-10-2007 06:24 PM

Re: tkinter - Screen Resolution
 
On May 10, 1:29 am, "Eric Brunel" <eric.bru...@pragmadev.com> wrote:
> On Wed, 09 May 2007 18:37:32 +0200, <rahulna...@yahoo.com> wrote:
> > Hi,
> > I have developed a GUI usingtkinter(grid geometory manager).
> > The structure is a top frame containing multiple subframes. Each
> > subframe has a combination of widgets like(Entry, label,
> > button,listboxes). 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(before 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 anyTkinterwidget. 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.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



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



All times are GMT. The time now is 05:28 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.