def monpage(self): vbox = Gtk.VBox() hbox2 = Gtk.HBox() self.tree = treehand.TreeHand(self.tree_sel_row) hbox2.pack_start(self.tree.stree, True, True, 0) self.txt1 = Gtk.Label(label="None") hbox2.pack_start(self.txt1, True, True, 0) vbox.pack_start(hbox2, True, True, 0) return vbox
def __init__(self): self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("Python Image Recognition") window.set_position(gtk.WIN_POS_CENTER) #ic = gtk.Image(); ic.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON) #window.set_icon(ic.get_pixbuf()) window.set_flags(gtk.CAN_FOCUS | gtk.SENSITIVE) window.set_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.KEY_PRESS_MASK | gtk.gdk.KEY_RELEASE_MASK | gtk.gdk.FOCUS_CHANGE_MASK) window.connect("destroy", self.OnExit) window.connect("button-press-event", self.area_button) window.connect("key-press-event", self.key_press_event) self.pangolayout = self.window.create_pango_layout("a") try: window.set_icon_from_file("icon.png") except: pass vbox = gtk.VBox() hbox = gtk.HBox() hbox2 = gtk.HBox() self.hbox2 = gtk.HBox() self.spacer(self.hbox2) self.area = img_main.img_main() self.hbox2.add(self.area) try: # Load default image(s) #self.load("images/african.jpg") #self.load("images/IMG_0823.jpg") #self.load("images/IMG_0827.jpg") self.load("images/enrolled.pgm") except: pyimgutils.msg("Cannot load file") vbox2 = gtk.VBox() self.tree = treehand.TreeHand(self.tree_sel_row) vbox2.add(self.tree.stree) #vbox2.add(self.area2) self.area3 = gtk.DrawingArea() vbox2.add(self.area3) self.hbox2.add(vbox2) vbox.pack_start(self.hbox2) self.buttons(hbox, window) self.buttons2(hbox2, window) vbox.pack_start(hbox, False) vbox.pack_start(hbox2, False) window.add(vbox) # Move to current monitor corner xxx, yyy = window.get_position() #print xxx, yyy window.move(xxx, 65)
def __init__(self): self.window = window = Gtk.Window(Gtk.WindowType.TOPLEVEL) window.set_title("Python Stickies") window.set_position(Gtk.WindowPosition.CENTER) #ic = Gtk.Image(); ic.set_from_stock(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.BUTTON) #window.set_icon(ic.get_pixbuf()) www, hhh = sutil.get_screen_wh() #print "www", www, "hhh", hhh #print "xx / yy", sutil.get_screen_xy() window.set_default_size(www / 3, hhh / 3) window.set_flags(Gtk.CAN_FOCUS | Gtk.SENSITIVE) window.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK | Gdk.EventMask.FOCUS_CHANGE_MASK) window.connect("unmap", self.OnExit) window.connect("key-press-event", self.key_press_event) window.connect("button-press-event", self.area_button) window.set_icon_from_file("icon.png") vbox = Gtk.VBox() hbox = Gtk.HBox() lab1 = Gtk.Label(label="") hbox.pack_start(lab1, True, True, 0) tree = treehand.TreeHand(self.tree_sel_row) self.tree = tree vbox.pack_start(tree.stree, True, True, 0) butt1 = Gtk.Button(" _New Sticky ") butt1.connect("clicked", self.show_new, window) hbox.pack_start(butt1, False) butt1d = Gtk.Button(" _Edit Sticky ") butt1d.connect("clicked", self.edit_stick, window) hbox.pack_start(butt1d, False) butt2 = Gtk.Button(" _Search ") butt2.connect("clicked", self.search, window) hbox.pack_start(butt2, False) butt22 = Gtk.Button(" Show _All ") butt22.connect("clicked", self.show_all_sticks, window) hbox.pack_start(butt22, False) butt21 = Gtk.Button(" Show _One ") butt21.connect("clicked", self.show_one, window) hbox.pack_start(butt21, False) lab2 = Gtk.Label(label="") hbox.pack_start(lab2, True, True, 0) vbox.pack_start(hbox, False) hbox2 = Gtk.HBox() lab3 = Gtk.Label(label="") hbox2.pack_start(lab3, True, True, 0) butt3 = Gtk.Button(" _Hide All ") butt3.connect("clicked", self.hide_all, window) hbox2.pack_start(butt3, False) butt31 = Gtk.Button(" H_ide One ") butt31.connect("clicked", self.hide_one, window) hbox2.pack_start(butt31, False) butt43 = Gtk.Button(" _Delete One ") butt43.connect("clicked", self.del_one, window) hbox2.pack_start(butt43, False) butt4 = Gtk.Button(" Hide _Main ") butt4.connect("clicked", self.hide_main, window) hbox2.pack_start(butt4, False) butt41 = Gtk.Button(" _Keep Above ") butt41.connect("clicked", self.above_one, window) hbox2.pack_start(butt41, False) butt5 = Gtk.Button(" E_xit ") butt5.connect("clicked", self.exit_all) hbox2.pack_start(butt5, False) lab4 = Gtk.Label(label="") hbox2.pack_start(lab4, True, True, 0) vbox.pack_start(hbox2, False) window.add(vbox)
def __init__(self): self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("Python Stickies") window.set_position(gtk.WIN_POS_CENTER) #ic = gtk.Image(); ic.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON) #window.set_icon(ic.get_pixbuf()) www = gtk.gdk.screen_width(); hhh = gtk.gdk.screen_height(); #window.set_default_size(www/2, hhh/2) window.set_flags(gtk.CAN_FOCUS | gtk.SENSITIVE) window.set_events( gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.KEY_PRESS_MASK | gtk.gdk.KEY_RELEASE_MASK | gtk.gdk.FOCUS_CHANGE_MASK ) window.connect("destroy", self.OnExit) window.connect("key-press-event", self.key_press_event) #window.connect("button-press-event", self.area_button) try: window.set_icon_from_file("icon.png") except: pass vbox = gtk.VBox(); hbox = gtk.HBox() lab1 = gtk.Label(""); hbox.pack_start(lab1) hbox2 = gtk.HBox() lab2 = gtk.Label(""); hbox2.pack_start(lab2) wwww = 2 * www / 3 hhhh = 2 * hhh / 3 #pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, wwww, hhhh) #pixbuf.fill(0xccccccFF) self.area = gtk.DrawingArea() self.area.set_size_request(wwww, hhhh) self.area.connect("expose-event", self.expose) self.image = gtk.Image() #self.image.set_from_file("african.jpg") #self.image.set_from_file("IMG_0823.jpg") self.image.set_from_file("IMG_0827.jpg") iw = self.image.get_pixbuf().get_width() ih = self.image.get_pixbuf().get_height() print "Image Size:", iw, ih, "Window Size:", wwww, hhhh iww = wwww; ihh = hhhh if iw > ih: scalex = float(wwww)/iw else: scalex = float(hhhh)/ih iww = iw * scalex pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, wwww, hhhh) self.image2 = gtk.Image() self.image2.set_from_pixbuf(pixbuf) self.image.get_pixbuf().scale(self.image2.get_pixbuf(), 0, 0, iww, ihh, 0, 0, scalex, scalex, gtk.gdk.INTERP_TILES) hbox2.add(self.area) self.tree = treehand.TreeHand(self.tree_sel_row) hbox2.add(self.tree.stree) vbox.pack_start(hbox2) lab11 = gtk.Label(""); hbox.pack_start(lab11, True ) butt1 = gtk.Button(" _Load Image ") butt1.connect("clicked", self.load_image, window) hbox.pack_start(butt1, False) butt1 = gtk.Button(" _Analize Image ") butt1.connect("clicked", self.anal_image, window) hbox.pack_start(butt1, False) lab12 = gtk.Label(""); hbox.pack_start(lab12, True ) vbox.pack_start(hbox, False) window.add(vbox)