[pygtk] antialias gnomecanvas? oops forgot code.

Andi Albrecht lists at andialbrecht.de
Wed Jul 26 20:06:04 WST 2006


Hi Tobias,

you have to pass the "aa" argument to the constructor:

self.acanvas = gnomecanvas.Canvas(aa=True)

and remove the line "self.acanvas.aa = True"

Regards,

Andi


Tobias Bengtsson wrote:
> Hi, I'm thinking about using gnomecanvas because I want support for
> antialiasing. According to pydoc I should set the property aa to get
> antialiasing enabled. I wrote a small test example to do this but it
> doesn't get antialiased. :-(
> At least not on my computer, ubuntu linux (dapper). Could you verify
> this and perhaps give me some hint about what's wrong?
> 
> regards, Tobias
> 
> 
> ------------------------------------------------------------------------
> 
> #!/usr/bin/env python
> 
> import gtk
> import gnomecanvas
> 
> class CanvasTest:
>     def __init__(self):
>         self.width = 50
>         self.height = 50
>     def main(self):
>         # Open window to hold canvas.
>         win = gtk.Window()
>         win.connect('destroy', lambda s:gtk.main_quit())
> 
>         # Create canvas.
>         self.acanvas = gnomecanvas.Canvas()
>         self.acanvas.set_size_request(self.width, self.height)
>         self.acanvas.set_scroll_region(0,0, self.width, self.height)
>         win.add(self.acanvas)
>         self.acanvas.aa = True
>         self.acanvas.show()
> 
>         type = 'GnomeCanvasEllipse'
> 
>         w = self.acanvas.root().add(type, x1=10, y1=10, x2=40, y2=40, 
>                                    fill_color='red', outline_color='black',
>                                    width_units=1.0)
> 
>         win.show()
> 
> if __name__ == '__main__':
>     c = CanvasTest()
>     c.main()
>     gtk.main()
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



More information about the pygtk mailing list