-
-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (19 loc) · 693 Bytes
/
main.py
File metadata and controls
28 lines (19 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gi
gi.require_version("Gtk", "4.0")
from gi.repository import Gtk
import workbench
@Gtk.Template(string=workbench.template)
class AwesomeButton(Gtk.Button):
# This is normally just "AwesomeButton" as defined in the XML/Blueprint.
# In your actual code, just put that here. We need to do it like this for technical reasons.
__gtype_name__ = workbench.template_gtype_name
@Gtk.Template.Callback()
def onclicked(self, _button):
print("Clicked")
container = Gtk.ScrolledWindow()
flow_box = Gtk.FlowBox(hexpand=True)
container.set_child(flow_box)
for _ in range(100):
widget = AwesomeButton()
flow_box.append(widget)
workbench.preview(container)