Il giorno mer, 02/09/2009 alle 21.13 +0000, [email protected] ha scritto:
> How could i create a Circular Button?

The attached is ugly code I had somewhere, but it can give you an idea.

I'm not sure however it will work outside Linux.

Pietro


import gtk, gobject


N,M=200,200

drag_icon_xpm = [
str(N)+" "+str(M)+" 1 1",
"       c None"]+[' '*N]*M


w = gtk.Window()

def apply_mask():
    p = gtk.gdk.pixmap_create_from_xpm_d(w.window , None, drag_icon_xpm)[1]
    r=p.cairo_create()
    r.arc(N/2, M/2, min(N,M)/2, .0001, 0)
    r.fill()
    w.shape_combine_mask(p, 0, 0)
    w.set_decorated(False)
    return
        
def set_back():
    m = gtk.gdk.bitmap_create_from_data(None, '0x00, 0x00, '*1000, 300, 300)
    w.shape_combine_mask(m, 0, 0)
    
b=gtk.Button("Click me,\n stupid")
w.add(b)
b.connect('released', gtk.main_quit)
w.set_size_request(200,200)
w.show_all()

gobject.idle_add(apply_mask)

gtk.main()

Attachment: signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to