By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 __init__.py

View raw Download
text/x-script.python • 582 B
Python script, ASCII text executable
        
            
1
import panorama_panel
2
3
import gi
4
gi.require_version("Gtk", "4.0")
5
6
from gi.repository import Gtk
7
8
9
class LabelApplet(panorama_panel.Applet):
10
name = "Label"
11
description = "Show a text"
12
13
def __init__(self, orientation=Gtk.Orientation.HORIZONTAL, config=None):
14
super().__init__(orientation=orientation, config=config)
15
if config is None:
16
config = {}
17
self.label = Gtk.Label()
18
self.label.set_text(config.get("text", "Label"))
19
self.append(self.label)
20
21
def get_config(self):
22
return {"text": self.label.get_text()}
23