def voidplace(self): """ Construct a voidplace """ # print self._entry.allocation.width self._xmp = background_xpm win_tmp = self._entry.window self._voidplace = gtk.gdk.Window( win_tmp, self._entry.allocation.width, 20, gtk.gdk.WINDOW_CHILD, (gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.EXPOSURE_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.LEAVE_NOTIFY_MASK), gtk.gdk.INPUT_OUTPUT, "voidplace", self._entry.allocation.x, self._entry.allocation.y, self._entry.get_visual(), self._entry.get_colormap(), gtk.gdk.Cursor(self._entry.get_display(), gdk.LEFT_PTR), "", "", True, ) self._voidplace.set_user_data(self._entry) temp_map = gdk.pixmap_colormap_create_from_xpm_d(self._voidplace, self._entry.get_colormap(), None, self._xmp) self._voidplace.set_back_pixmap(temp_map[0], False) c = self._voidplace.get_colormap() color = c.alloc_color(0, 65555, 0) self._voidplace.show() self._vp = True
def do_realize(self): self.set_flags(self.flags() | gtk.REALIZED) temporary_window = self.get_parent_window() events = (gdk.EXPOSURE_MASK | gdk.BUTTON_PRESS_MASK | gdk.BUTTON_RELEASE_MASK | gdk.MOTION_NOTIFY ) self.window = gdk.Window(temporary_window, width = self.allocation.width, height = self.allocation.height, window_type = gdk.WINDOW_CHILD, event_mask = (self.get_events() | events ), wclass = gdk.INPUT_OUTPUT, x = self.allocation.x, y = self.allocation.y) self.window.set_user_data(self) self.style.attach(self.window) temp_map = gdk.pixmap_colormap_create_from_xpm_d(self.window, self.get_colormap(), None, self._xmp) self.window.set_back_pixmap(temp_map[0], False)
def voidplace(self): ''' Construct a voidplace ''' #print self._entry.allocation.width self._xmp = background_xpm win_tmp = self._entry.window self._voidplace = gtk.gdk.Window(win_tmp, self._entry.allocation.width , 20, gtk.gdk.WINDOW_CHILD, (gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.EXPOSURE_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.LEAVE_NOTIFY_MASK), gtk.gdk.INPUT_OUTPUT, 'voidplace', self._entry.allocation.x,self._entry.allocation.y, self._entry.get_visual(), self._entry.get_colormap(), gtk.gdk.Cursor(self._entry.get_display(), gdk.LEFT_PTR), '', '', True) self._voidplace.set_user_data(self._entry) temp_map = gdk.pixmap_colormap_create_from_xpm_d(self._voidplace, self._entry.get_colormap(), None, self._xmp) self._voidplace.set_back_pixmap(temp_map[0], False) c= self._voidplace.get_colormap() color = c.alloc_color(0,65555,0) self._voidplace.show() self._vp = True
def voidplace(self): ''' Construct a voidplace ''' #if (self.window == None): # return self._xmp = background_xpm win_tmp = self.get_parent_window() self._voidplace = gtk.gdk.Window(win_tmp, self.allocation.width , self.allocation.height, gtk.gdk.WINDOW_CHILD, (gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.LEAVE_NOTIFY_MASK), gtk.gdk.INPUT_OUTPUT, 'voidplace', self.allocation.x,self.allocation.y, self.get_visual(), self.get_colormap(), gtk.gdk.Cursor(self.get_display(), gdk.LEFT_PTR), '', '', True) self._voidplace.set_user_data(self) self.style.attach(self.window) temp_map = gdk.pixmap_colormap_create_from_xpm_d(self._voidplace, self.get_colormap(), None, self._xmp) self._voidplace.set_back_pixmap(temp_map[0], False) c= self._voidplace.get_colormap() color = c.alloc_color(0,65555,0) self._draw_gc = gtk.gdk.GC(self._voidplace, line_width=6, foreground = color ) self._voidplace.draw_rectangle(self._draw_gc, True, self.allocation.x, self.allocation.y, self.allocation.width, self.allocation.height) self._voidplace.show() self._vp = True
def voidplace(self): """ Construct a voidplace """ # if (self.window == None): # return self._xmp = background_xpm win_tmp = self.get_parent_window() self._voidplace = gtk.gdk.Window( win_tmp, self.allocation.width, self.allocation.height, gtk.gdk.WINDOW_CHILD, (gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.LEAVE_NOTIFY_MASK), gtk.gdk.INPUT_OUTPUT, "voidplace", self.allocation.x, self.allocation.y, self.get_visual(), self.get_colormap(), gtk.gdk.Cursor(self.get_display(), gdk.LEFT_PTR), "", "", True, ) self._voidplace.set_user_data(self) self.style.attach(self.window) temp_map = gdk.pixmap_colormap_create_from_xpm_d(self._voidplace, self.get_colormap(), None, self._xmp) self._voidplace.set_back_pixmap(temp_map[0], False) c = self._voidplace.get_colormap() color = c.alloc_color(0, 65555, 0) self._draw_gc = gtk.gdk.GC(self._voidplace, line_width=6, foreground=color) self._voidplace.draw_rectangle( self._draw_gc, True, self.allocation.x, self.allocation.y, self.allocation.width, self.allocation.height ) self._voidplace.show() self._vp = True
def __init__(self): gtksheet.Sheet.__init__(self, 1000, 26) self.set_background(gdk.color_parse("light yellow")) self.set_grid(gdk.color_parse("light blue")) for column in xrange(self.get_columns_count()): name = chr(ord("A") + column) self.column_button_add_label(column, name) self.set_column_title(column, name) self.row_button_add_label(0, "This is\na multiline\nlabel") self.row_button_add_label(1, "This is long label") self.row_button_justify(0, gtk.JUSTIFY_RIGHT) range = gtksheet.SheetRange(1,1,2,3) self.clip_range(range) self.range_set_font(range, pango.FontDescription("Arial 28")) self.range_set_foreground(range, gdk.color_parse("red")) self.set_cell(1,2, gtk.JUSTIFY_CENTER, "Welcome to") range.row0 = 2 self.range_set_font(range, pango.FontDescription("Arial 36")) self.range_set_foreground(range, gdk.color_parse("blue")) self.set_cell(2,2, gtk.JUSTIFY_CENTER, "python-gtksheet") range = gtksheet.SheetRange(3,0,3,4) self.range_set_background(range, gdk.color_parse("dark gray")) self.range_set_foreground(range, gdk.color_parse("green")) self.set_cell(3, 2, gtk.JUSTIFY_CENTER, "a Matrix widget for Gtk+") texts =["GtkSheet is a matrix where you can allocate cells of text.", "Cell contents can be edited interactively with an specially designed entry", "You can change colors, borders, and many other attributes", "Drag & drop or resize the selection clicking the corner or border", "Store the selection on the clipboard pressing Ctrl-C", "You can add buttons, charts, pixmaps, and other widgets"] for i in xrange(len(texts)): self.set_cell(i+4, 1, gtk.JUSTIFY_LEFT, texts[i]) colormap = gdk.colormap_get_system() pixmap, mask = gdk.pixmap_colormap_create_from_xpm_d(None, colormap, None, bullet_xpm) for i in xrange(6): image = gtk.image_new_from_pixmap(pixmap, mask) image.show() self.attach( image, 4+i, 0, gtk.EXPAND, gtk.EXPAND, 0, 0) pixmap, mask = gdk.pixmap_colormap_create_from_xpm_d(None, colormap, None, smile_xpm) self.button_attach( gtk.image_new_from_pixmap(pixmap, mask), -1, 5) self.curve = gtk.Curve() self.curve.show() self.curve.set_range(0, 200, 0, 200) show_button = gtk.Button("Show me a plot") show_button.show() show_button.set_size_request(100, 60) self.attach(show_button, 12, 2, gtk.FILL, gtk.FILL, 5, 5) show_button.connect("clicked", self._show_child_cb) self.connect("key_press_event", self._key_press_cb)