[hamster-applet] simplified example a bit



commit fde587c95bf7ea36de46d36aaebb888fedef30ee
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Dec 27 14:13:52 2009 +0000

    simplified example a bit

 hamster/graphics.py |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/hamster/graphics.py b/hamster/graphics.py
index 828ba09..d6eb174 100644
--- a/hamster/graphics.py
+++ b/hamster/graphics.py
@@ -219,8 +219,8 @@ class SampleArea(Area):
         self.font_size = 32
         self.layout.set_text("Hello, World!")
         
-        self.fill_area(self.rect_x,
-                       self.rect_y,
+        self.fill_area(round(self.rect_x),
+                       round(self.rect_y),
                        self.rect_width,
                        self.rect_height, (168, 186, 136))
 
@@ -231,18 +231,11 @@ class SampleArea(Area):
         
 
 class BasicWindow:
-    # close the window and quit
-    def delete_event(self, widget, event, data=None):
-        gtk.main_quit()
-        return False
-
     def __init__(self):
-        # Create a new window
-        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-    
-        self.window.set_title("Graphics Module")
-        self.window.set_size_request(300, 300)
-        self.window.connect("delete_event", self.delete_event)
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        window.set_title("Graphics Module")
+        window.set_size_request(300, 300)
+        window.connect("delete_event", lambda *args: gtk.main_quit())
     
         self.graphic = SampleArea()
         
@@ -254,8 +247,8 @@ class BasicWindow:
 
         box.add_with_properties(button, "expand", False)
     
-        self.window.add(box)
-        self.window.show_all()
+        window.add(box)
+        window.show_all()
         
         # drop the hello on init
         self.graphic.animate(self.graphic,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]