Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a Gtk+3 window full screen?

I'm looking for a functional example that would demonstrate how to make a Gtk+3 window full screen.

like image 866
yPhil Avatar asked Jun 30 '16 04:06

yPhil


Video Answer


1 Answers

OK, I figured it out by reading 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)
like image 98
yPhil Avatar answered Nov 09 '22 00:11

yPhil