tkinter - Screen Resolution

Discussion in 'Python' started by rahulnag22@yahoo.com, May 9, 2007.

  1. Guest

    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
    , May 9, 2007
    #1
    1. Advertising

  2. Guest

    On May 9, 10:37 am, 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
    , May 9, 2007
    #2
    1. Advertising

  3. Eric Brunel Guest

    On Wed, 09 May 2007 18:37:32 +0200, <> 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+-'])"
    Eric Brunel, May 10, 2007
    #3
  4. Guest

    On May 10, 1:29 am, "Eric Brunel" <> wrote:
    > On Wed, 09 May 2007 18:37:32 +0200, <> 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
    , May 10, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew FPGA
    Replies:
    0
    Views:
    960
    Andrew FPGA
    Sep 26, 2005
  2. Jenny

    Screen resolution

    Jenny, Aug 26, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    354
    Ken Schaefer
    Aug 26, 2003
  3. Screen resolution

    , Nov 3, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    339
    Teemu Keiski
    Nov 3, 2003
  4. Guadala Harry

    Discover User's Screen Resolution

    Guadala Harry, Jul 1, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    403
    bruce barker
    Jul 1, 2004
  5. Pat
    Replies:
    5
    Views:
    532
Loading...

Share This Page