あなたは完全にこれについてあなたのウィンドウマネージャーに翻弄されています、そしてここでの重要な問題は:
最大化されることなく
基本的に最大化とサイズ変更は2つの別個のものであり、最大化されていないときの場所を思い出せるようにするために、いくつかのハックが残されています。
したがって、この恐ろしいハックを紹介する前に、適切な最大化の使用を検討し、それに満足することをお勧めします。
だからここに行きます:
import gtk
# Even I am ashamed by this
# Set up a one-time signal handler to detect size changes
def _on_size_req(win, req):
x, y, w, h = win.get_allocation()
print x, y, w, h # just to prove to you its working
win.disconnect(win.connection_id)
win.unmaximize()
win.window.move_resize(x, y, w, h)
# Create the window, connect the signal, then maximise it
w = gtk.Window()
w.show_all()
w.connection_id = w.connect('size-request', _on_size_req)
# Maximizing will fire the signal handler just once,
# unmaximize, and then resize to the previously set size for maximization.
w.maximize()
# run this monstrosity
gtk.main()