Seite 1 von 1

Fenster Form

Verfasst: Dienstag 24. November 2009, 11:01
von Andyh
Hallo

Ich brauche ein Fenster in dieser mit dieser Form:
Bild

Das geht ja mit cario, blos bekomme ich die form nicht hin.

Hier was zum Spielen:

Code: Alles auswählen

import gtk
import cairo

class W():
    def __init__(self):
        self.w = gtk.Window()
        self.w.set_decorated(False)
        self.w.add(gtk.Label("Hallo\nhallo\nHallo\nhallo"))
        self.w.connect('size-allocate', self.expose)
        self.w.show_all()
        gtk.main()
        
    def expose(self, widget, event):
        w = self.w.allocation.width
        h = self.w.allocation.height
        pix = gtk.gdk.Pixmap(None, w, h, 1)
        cr = pix.cairo_create()


        cr.set_line_width(2)    
          
        cr.set_operator(cairo.OPERATOR_DEST_OUT)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)
        
        cr.line_to(w, 0)
        cr.line_to(w, h)
        cr.line_to(0, h)
        cr.line_to(0, 0
          
        cr.stroke_preserve()
        cr.fill()
          
        self.w.shape_combine_mask(pix, 0, 0)
        
W()
Gruß
Andyh