diff options
author | Walter Bender <walter@sugarlabs.org> | 2013-12-14 13:32:51 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2013-12-14 13:32:51 (GMT) |
commit | a50e4629e180366808ee4cb6af5952b5cf4ebf00 (patch) | |
tree | 029c59f3d67aa9c9d68512bc1e759410972ecc84 /data | |
parent | 5317f51328cbd890e2f24de7cfc1a61ea7ad016c (diff) |
more clean up of lang and tutorials
Diffstat (limited to 'data')
-rw-r--r-- | data/en/tutorials/Tutorial_07_gtk_basic_form.py | 6 | ||||
-rw-r--r-- | data/en/tutorials/Tutorial_08_gtk_button_form.py | 14 | ||||
-rw-r--r-- | data/en/tutorials/Tutorial_09_gtk_entry.py | 17 | ||||
-rw-r--r-- | data/en/tutorials/Tutorial_10_gtk_dialog_button.py | 29 |
4 files changed, 25 insertions, 41 deletions
diff --git a/data/en/tutorials/Tutorial_07_gtk_basic_form.py b/data/en/tutorials/Tutorial_07_gtk_basic_form.py index bcff13c..add05d4 100644 --- a/data/en/tutorials/Tutorial_07_gtk_basic_form.py +++ b/data/en/tutorials/Tutorial_07_gtk_basic_form.py @@ -1,12 +1,12 @@ from gi.repository import Gtk class PyApp(Gtk.Window): + def __init__(self): super(PyApp, self).__init__() - self.set_title("Hello World!!") - self.connect("destroy", Gtk.main_quit) + self.set_title('Hello World!!') + self.connect('destroy', Gtk.main_quit) self.set_size_request(250, 150) - self.set_position(Gtk.WIN_POS_CENTER) self.show() PyApp() diff --git a/data/en/tutorials/Tutorial_08_gtk_button_form.py b/data/en/tutorials/Tutorial_08_gtk_button_form.py index 8a496ae..6f7f8e7 100644 --- a/data/en/tutorials/Tutorial_08_gtk_button_form.py +++ b/data/en/tutorials/Tutorial_08_gtk_button_form.py @@ -2,17 +2,21 @@ from gi.repository import Gtk class PyApp(Gtk.Window): def __init__(self): + super(PyApp, self).__init__() - self.set_title("Button") + self.set_title('Button') self.set_size_request(250, 200) - self.set_position(Gtk.WIN_POS_CENTER) - btn1 = Gtk.Button("Button") + def button_cb(widget): + print 'click' + + button = Gtk.Button('Button') fixed = Gtk.Fixed() - fixed.put(btn1, 20, 30) + fixed.put(button, 20, 30) + button.connect('clicked', button_cb) - self.connect("destroy", Gtk.main_quit) + self.connect('destroy', Gtk.main_quit) self.add(fixed) self.show_all() diff --git a/data/en/tutorials/Tutorial_09_gtk_entry.py b/data/en/tutorials/Tutorial_09_gtk_entry.py index 40873bf..5be537d 100644 --- a/data/en/tutorials/Tutorial_09_gtk_entry.py +++ b/data/en/tutorials/Tutorial_09_gtk_entry.py @@ -1,19 +1,28 @@ from gi.repository import Gtk +from gi.repository import Gdk class PyApp(Gtk.Window): + def __init__(self): super(PyApp, self).__init__() - self.set_title("Hello World!!") - self.connect("destroy", Gtk.main_quit) + self.set_title('Text Entry') self.set_size_request(250, 150) - self.set_position(Gtk.WIN_POS_CENTER) + def entry_cb(widget, event): + if Gdk.keyval_name(event.keyval) == 'Return': + print widget.get_text() + entry = Gtk.Entry() + entry.show() fixed = Gtk.Fixed() + fixed.show() fixed.put(entry, 20, 30) - self.connect("destroy", Gtk.main_quit) self.add(fixed) self.show() + entry.connect('key_press_event', entry_cb) + + self.connect('destroy', Gtk.main_quit) + PyApp() Gtk.main() diff --git a/data/en/tutorials/Tutorial_10_gtk_dialog_button.py b/data/en/tutorials/Tutorial_10_gtk_dialog_button.py deleted file mode 100644 index 6bdd198..0000000 --- a/data/en/tutorials/Tutorial_10_gtk_dialog_button.py +++ /dev/null @@ -1,29 +0,0 @@ -from gi.repository import Gtk - -class PyApp(Gtk.Window): - def __init__(self): - super(PyApp, self).__init__() - self.set_size_request(300, 150) - self.set_position(Gtk.WIN_POS_CENTER) - self.connect("destroy", Gtk.main_quit) - self.set_title("Click button") - - - button = Gtk.Button("Click me!!!") - button.set_size_request(80, 30) - button.connect("clicked", self.on_clicked) - - fix = Gtk.Fixed() - fix.put(button, 20, 20) - - self.add(fix) - self.show_all() - - def on_clicked(self, widget): - about = Gtk.AboutDialog() - about.set_comments("Hello there!!!") - about.run() - about.destroy() - -PyApp() -Gtk.main() |