a simple graphic library

polux polux2001 at wanadoo.fr
Tue Aug 27 20:10:02 CEST 2002


Tim Lavoie wrote:
> In article <3D6B6C94.9020203 at wanadoo.fr>, polux wrote:
> 
>>Miki Tebeka wrote:
>>
>>>Hello Polux,
>>>
>>>
>>>
>>>>Do you know if there is a simple graphic module for python (like SRGP 
>>>>for C in exemple) which would trace very simple meshes like points, 
>>>>rectangles, circles, etc on win32 ?
>>>
>>>http://www.pythonware.com/products/pil/
>>>
>>>HTH.
>>>
>>>Miki
>>
>>It is not exactly what I want (and the setup doesn't work very well on 
>>my computer)
>>
>>I'd like commands like point(10,10) or something like this to trace a 
>>point on the scree like with old langages like BASIC
> 
> 
> Well, to paint on the screen, you need to have some sort of graphic
> interface on which to draw. So, you will have to deal with windows, events
> and so on anyway, and Tkinter is probably about as simple as you can expect.
> If nothing else, you should be able to copy and paste some demo code to
> create a single window with a canvas on it, and use the canvas' graphic
> primitives to doodle on it.
> 
> For example, this will create a window with a white background, and draws
> 100 random ovals on it:
> 
> 
> from Tkinter import *
> import random
> 
> h = 200
> w = 300
> 
> class Application(Frame):
>     def createWidgets(self):
>         self.QUIT = Button(self)
>         self.QUIT["text"] = "Quit"
>         self.QUIT["fg"] = "red"
>         self.QUIT["command"] = self.quit
> 
>         self.QUIT.pack({"side": "top"})
> 
> 
>         self.doodle = Canvas(self, bg="#FFFFFF", height=h, width=w)
>         self.doodle.pack({"side": "top"})
>         
> 
>     def __init__(self,master=None):
>         Frame.__init__(self,master)
>         self.pack()
>         self.createWidgets()
> 
>     def do_something(self):
>         foo = random.Random()
>         for i in range(100):
>             red = foo.randrange(0,255)
>             green = foo.randrange(0,255)
>             blue = foo.randrange(0,255)
>             top = foo.randrange(0,h)
>             bottom = foo.randrange(top,h)
>             left = foo.randrange(0,w)
>             right = foo.randrange(left,w)
>             self.doodle.create_oval(left,top,right,bottom,
>                                     fill = '#%.2X%.2X%.2X' % (red,green,blue))
>         
> app = Application()
> app.do_something()
> 
> app.mainloop()

The problem is that Tkinter is too "simple" :)
ie you can ask it to delete a circle

what I'm searching for is a screen on which you can trace very simple 
things.....i'm trying to make a 3d engine from the beginning




More information about the Python-list mailing list