[pygtk] How to actually draw lines on gtk.Drawing Area?
Shashank,Ankit,Amit
gnowser at gmail.com
Sun Mar 26 15:46:16 WST 2006
Hi
I am trying to embed a canvas using gtk.DrawingArea in one of my
applications
I plan to use it to draw lines and rectangles later on
Can anyone tell me how to draw lines or rectangles or standard shapes on
gtk.DrawingArea?
I tried the following steps
graphical_window = gtk.ScrolledWindow()
graphical_window.set_size_request(300,450)
area = gtk.DrawingArea()
area.show()
area.set_size_request(120,120)
drawable = area.window
drawable.draw_line(gc,20,25,30,35)
graphical_window.add_with_viewport(area)
drawable.show()
graphical_window.show()
If i do not specify or create the graphics context "gc" does it take the
default value?
Are the draw_line() and draw_rectangle() standard functions? If not, is the
remaining portion alright?
My top level widget is a window called window1 and i am trying to pack the
Drawing Area inside a Scrolled window which has been packed into window1
later on in the code
I get an error saying
Traceback (most recent call last):
File "E:\main.py", line 2766, in -toplevel-
window1()
File "E:\main.py", line 2611, in __init__
drawable.draw_line(gc,20,25,30,35)
AttributeError: 'NoneType' object has no attribute 'draw_line'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20060326/78a25a7b/attachment.htm
More information about the pygtk
mailing list