55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
import gi
|
|
|
|
gi.require_version("Gtk", "4.0")
|
|
from gi.repository import Gtk # NOQA: E402
|
|
|
|
|
|
class MainWindow(Gtk.ApplicationWindow):
|
|
def __init__(self, *args: Any, **kwargs: Any):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
# Make window fullscreen and borderless
|
|
self.set_decorated(False)
|
|
self.fullscreen()
|
|
|
|
# Main horizontal box to split the screen
|
|
main_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
|
main_box.set_homogeneous(True) # Make both halves equal size
|
|
|
|
# Left half
|
|
left_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
left_box.set_valign(Gtk.Align.CENTER)
|
|
left_box.set_halign(Gtk.Align.CENTER)
|
|
left_label = Gtk.Label(label="Left Side")
|
|
left_box.append(left_label)
|
|
|
|
# Right half
|
|
right_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
right_box.set_valign(Gtk.Align.CENTER)
|
|
right_box.set_halign(Gtk.Align.CENTER)
|
|
right_label = Gtk.Label(label="Right Side")
|
|
right_box.append(right_label)
|
|
|
|
# Add both halves to main box
|
|
main_box.append(left_box)
|
|
main_box.append(right_box)
|
|
|
|
self.set_child(main_box)
|
|
|
|
|
|
class App(Gtk.Application):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def do_activate(self):
|
|
win = MainWindow(application=self)
|
|
win.present()
|
|
|
|
|
|
def main():
|
|
app = App()
|
|
app.run(None)
|