당신은이에 대한 윈도우 매니저의 자비에 완전히, 그리고 핵심 문제는 여기에 있습니다 :
그래서 우리는 해킹의 숫자로 남아 있습니다 극대화하지 않고 기본적으로 최대화 및 크기 조정은 두 개의 개별적인 작업이므로 최대화되지 않은 위치를 기억할 수 있습니다.
그래서 나는이 끔찍한 해킹을 보여주기 전에 적절한 최대화 사용을 고려해보고 기쁘게 생각합니다.
그래서 여기 간다 :
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()
알리, 이것은 아름답게 끔찍합니다! –
라스, 고마워! 그것은 높은 평가입니다! –