From 575dc51eb63b187b08cb7b1d5966afacaaf9ac44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alperen=20=C4=B0sa=20Nalbant?= Date: Sat, 2 Oct 2021 09:19:53 +0300 Subject: [PATCH] added revealer example --- handy/3-revealer.py | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 handy/3-revealer.py diff --git a/handy/3-revealer.py b/handy/3-revealer.py new file mode 100644 index 0000000..253d63d --- /dev/null +++ b/handy/3-revealer.py @@ -0,0 +1,50 @@ +selamun = "aleyküm" + +import gi, os +gi.require_version("Gtk", "3.0") +gi.require_version("Handy", "1") +from gi.repository import Gtk, Handy + +Handy.init() + +class MyWindow(Handy.Window): + def __init__(self): + super().__init__(title="Hello World") + self.set_default_size(500, 300) + + # WindowHandle + self.handle = Handy.WindowHandle() + self.add(self.handle) + + # WinBox + self.winBox = Gtk.Box(spacing=6, orientation=Gtk.Orientation.VERTICAL) + self.handle.add(self.winBox) + + # Revealer + self.revealer = Gtk.Revealer() + self.revealer.set_reveal_child(True) + self.winBox.pack_start(self.revealer, False, True, 0) + + # Headerbar + self.hb = Handy.HeaderBar() + self.hb.set_show_close_button(True) + self.hb.props.title = "Revealer Example" + self.revealer.add(self.hb) + + # MainBox + self.mainBox = Gtk.Box(spacing=6, orientation=Gtk.Orientation.VERTICAL) + self.winBox.pack_start(self.mainBox, True, False, 0) + + # Revealer button + self.rvBtn = Gtk.Button(label="Hide headerbar") + self.mainBox.pack_start(self.rvBtn, True, False, 0) + self.rvBtn.connect("clicked", self.on_rvBtn_clicked) + + def on_rvBtn_clicked(self, widget): + reveal = self.revealer.get_reveal_child() + self.revealer.set_reveal_child(not reveal) + +win = MyWindow() +win.connect("destroy", Gtk.main_quit) +win.show_all() +Gtk.main() \ No newline at end of file