Tags: define, geometry, method, position, programming, python, root, tkinter, toplevel, window, windowcalled

How to define a window's position (Tkinter)

On Programmer » Python

1,797 words with 2 Comments; publish: Wed, 30 Apr 2008 14:54:00 GMT; (20078.13, « »)

I am trying to use the geometry() method with the toplevel window

called root. I know that one can do the following:

root.geometry('400x400+200+200')

This will put the window in 200, 200 position with a size of 400x400.

Now, I don't really want to set the size. I simply want to set the

position of the window. I've tried this:

root.geometry('200+200')

However, this doesn't seem to work. What can I do to set the position

of the window without actually setting the size?

Thanks,

Harlin

All Comments

Leave a comment...

  • 2 Comments
    • I suspect you need to retrieve the window size, calculate the position

      based on the size, and reset size and position.

      You might look at http://www.ferg.org/easygui/index.html for some

      ideas. Scroll down to the definition of the __choicebox routine.

      Good luck!

      -- Steve Ferg

      #1; Wed, 30 Apr 2008 14:55:00 GMT
    • In article <1109516700.351898.72850.python.questionfor.info.l41g2000cwc.googlegroups.com>,

      "Harlin Seritt" <harlinseritt.python.questionfor.info.yahoo.com> wrote:

      >I am trying to use the geometry() method with the toplevel window

      >called root. I know that one can do the following:

      >root.geometry('400x400+200+200')

      >This will put the window in 200, 200 position with a size of 400x400.

      >Now, I don't really want to set the size. I simply want to set the

      >position of the window. I've tried this:

      >root.geometry('200+200')

      >However, this doesn't seem to work. What can I do to set the position

      >of the window without actually setting the size?

      You were almost there, but you need an initial "+":

      root.geometry("+200+200").

      -- Russell

      #2; Wed, 30 Apr 2008 14:56:00 GMT