如何制作 Gtk+3 window 全屏?
How to make a Gtk+3 window full screen?
我正在寻找一个功能示例来演示如何制作 Gtk+3 window 全屏。
好的,我通过阅读 the window state flags documentation:
弄明白了
win.connect("key-press-event", self.on_win_key_press_event)
win.connect("window-state-event", self.on_window_state_event)
#...
def fullscreen_mode(self):
if self.__is_fullscreen:
self.win.unfullscreen()
else:
self.win.fullscreen()
def on_win_key_press_event(self, widget, ev):
key = Gdk.keyval_name(ev.keyval)
if key == "f":
self.fullscreen_mode()
def on_window_state_event(self, widget, ev):
self.__is_fullscreen = bool(ev.new_window_state & Gdk.WindowState.FULLSCREEN)
我正在寻找一个功能示例来演示如何制作 Gtk+3 window 全屏。
好的,我通过阅读 the window state flags documentation:
弄明白了win.connect("key-press-event", self.on_win_key_press_event)
win.connect("window-state-event", self.on_window_state_event)
#...
def fullscreen_mode(self):
if self.__is_fullscreen:
self.win.unfullscreen()
else:
self.win.fullscreen()
def on_win_key_press_event(self, widget, ev):
key = Gdk.keyval_name(ev.keyval)
if key == "f":
self.fullscreen_mode()
def on_window_state_event(self, widget, ev):
self.__is_fullscreen = bool(ev.new_window_state & Gdk.WindowState.FULLSCREEN)