Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Window-positioning?

I tried to open a new window at the same position as another window.

My Code:

window2.set_position(window1.get_position())

But it doesn't work.

like image 567
MarcoQu Avatar asked Jun 26 '12 12:06

MarcoQu


People also ask

How do I change the location of a Python window?

Call GetConsoleWindow to get the console window handle. Then detach via FreeConsole . Then call MoveWindow or SetWindowPos to move and resize the console window.

How do you adjust a window position?

Right-click the window tab and select Move>View (to move a separate window). Move the mouse to where you want the window to display and left-click to confirm the move. Right-click the window tab and select Move>Tab Group (to move several tabbed windows) from the list.

How to fix position of a window in TKinter?

Initial Window Position To change this we can add the height and width position to the geometry method. When Tkinter positions a window it references the top left corner of the window. Here, we position the top left corner of the window right 300 pixels and down 300 pixels. Note the “+” symbol before each position.


1 Answers

set_position just sets a general hint (e.g. center the window). You need the move method:

window2.move(pos_x, pos_y)

see here: http://faq.pygtk.org/index.py?req=show&file=faq10.003.htp

like image 153
l4mpi Avatar answered Oct 03 '22 22:10

l4mpi