Applicazione di base funzionante.

This commit is contained in:
Emiliano Vavassori 2019-12-20 18:53:48 +01:00
commit cc015a7b28
3 changed files with 114 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
venv

81
test.glade Normal file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="windowMain">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Applicazione di test con GLADE e Python</property>
<property name="resizable">False</property>
<property name="icon_name">system-run</property>
<property name="type_hint">dialog</property>
<signal name="close" handler="gtk_main_quit" swapped="no"/>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<property name="homogeneous">True</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="btnUpdate">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="image_position">right</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_btnUpdate_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnQuit">
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="image_position">right</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="on_btnQuit_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Mostro il testo qui</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

32
test.py Normal file
View File

@ -0,0 +1,32 @@
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class App:
def on_btnUpdate_clicked(self, btn):
self.label.set_text("Aggiornato!")
def on_btnQuit_clicked(self, btn):
Gtk.main_quit()
def gtk_main_quit(self, btn):
Gtk.main_quit()
def __init__(self):
self.builder = Gtk.Builder()
self.builder.add_from_file('test.glade')
self.builder.connect_signals(self)
self.window = self.builder.get_object("windowMain")
self.window.show()
self.label = self.builder.get_object("lblText")
Gtk.main()
def __destroy__(self):
Gtk.main_quit()
if __name__ == '__main__':
a = App()