आप इस के लिए अपने विंडो प्रबंधक की दया पर पूरी तरह से कर रहे हैं, और प्रमुख मुद्दा यहाँ है:
बिना अधिकतम उपयोग हो रहा
तो हम हैक्स की संख्या के साथ छोड़ दिया जाता है , क्योंकि मूल रूप से अधिकतमकरण और आकार बदलना दो अलग-अलग चीजें हैं, ताकि आप यह याद कर सकें कि यह कहां अनैक्सिमाइज़ किया गया था।
तो इससे पहले कि मैं आपको यह भयानक हैक दिखाता हूं, मैं आपको उचित अधिकतम उपयोग करने पर विचार करने के लिए आग्रह करता हूं और बस इससे खुश रहूंगा।
तो यहाँ जाता है:
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()
स्रोत
2009-02-03 18:09:21
अली, यह बहुत ही भयानक है! –
लार्स, धन्यवाद! वह उच्च प्रशंसा है! –