MATTHIEU CADET wrote:
According to my problem with gtkEventBox, i've only one solution i think.... there is a way to force refresh all windows and widgets ? maybe my problem is a display bug or maybe i have too much gtkEventBox with gtkImage .Please if someone have any solution for me.
I found a C example on how to put a .png image in a cairo widget http://zetcode.com/tutorials/cairographicstutorial/cairoimages/ Here is a python script.
From: maty...@hotmail.com To: py...@butterflystitches.com.au Date: Mon, 26 Jan 2009 19:36:23 +0900 CC: pygtk@daa.com.au Subject: Re: [pygtk] Multi gtk.EventBox and gtk.Image cause artefacts Hi,I've try to replace gtkEventBox with a gtkButton, but it's the same problem...At a certain number of button are showed the button is not clickable :( Maybe it's another problem with the main Window or may i need to refresh; redraw or something like that ? Or maybe it's not possible with gtk to show lot of gtkEventBox,there is a limit on the EventBox ? or something related to the Window ?From: maty...@hotmail.com To: py...@butterflystitches.com.au Date: Sat, 24 Jan 2009 19:16:17 +0900 CC: pygtk@daa.com.au Subject: Re: [pygtk] Multi gtk.EventBox and gtk.Image cause artefacts Hi, No i haven't try this solution, but i don't want my image looks like a button, with the style of button you know rounded, and when you see the image as a button.Or maybe i can set a button style to "none" ? without the looks of a button.I will try this, thanks for your answer. Maty.Date: Sat, 24 Jan 2009 13:48:42 +1100 From: py...@butterflystitches.com.au To: maty...@hotmail.com CC: pygtk@daa.com.au Subject: Re: [pygtk] Multi gtk.EventBox and gtk.Image cause artefacts MATTHIEU CADET wrote:I've found a solution to remove those artefacts, but the solution is to don't use gtk.EventBox and just use gtk.Image...Have you tried making each image a button with the image inside the button?But for the moment its not very good for me because i need to keepthe image as "clickable" so i can get informations of wich image is clicked.Any help for this please? Thanks. Maty. From: maty...@hotmail.com To: pygtk@daa.com.au Date: Tue, 20 Jan 2009 19:54:44 +0900 Subject: [pygtk] Multi gtk.EventBox and gtk.Image cause artefacts Hi everybody! I'm trying to write a tool in PyGtk that shows user lot of images in a Window, each images must be "clickable", so i've put all of them into a gtk.EventBox. The problem now for me is, when the number of images is more than about 45 EventBox shown in the main Window, i got some strange artefacts near to the last image has been show. How can i fix those artefacts from EventBox ? and keep my images clickable ? Here the link to my code;glade and image : http://www.filefactory.com/file/a02c6df/n/multi_eventbox_example_zip Please if someone can help me on this. Thanks a lot. Maty.
#!/usr/bin/python # 48 x 48 pixel image filename="apple-red.png" import cairo import gtk class ImageFace(gtk.DrawingArea): def __init__(self): gtk.DrawingArea.__init__(self) # load the image self.image = cairo.ImageSurface.create_from_png(filename) # the two callback needed self.connect("expose_event", self.expose) self.connect("button_press_event", self.on_button_press) # set the button press event to happen self.add_events(gtk.gdk.BUTTON_PRESS_MASK) self.set_size_request(610, 610) def expose(self, widget, event): cr = widget.window.cairo_create() # draw the image 100 times for x in range(10,560,60) : for y in range(10,560,60) : cr.set_source_surface(self.image, x, y) cr.paint(); return False def on_button_press(self, widget, event): # filter out all but the left mouse clicks if event.button == 1 : # find out where in the image we clicked x = event.x % 60 y = event.y % 60 # see if we are on an image if x > 12 and y > 17 and x < 50 and y < 50 : # print what image we clicked on print "you clicked on image %d x %d" % (int(event.x / 60), int(event.y / 60)) def main(): window = gtk.Window() images = ImageFace() sw = gtk.ScrolledWindow() window.add(sw) sw.add_with_viewport(images) window.connect("destroy", gtk.main_quit) window.show_all() gtk.main() if __name__ == "__main__": main()
<<inline: apple-red.png>>
_______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/