Grazie per la risposta Enrico, ma dopo che faccio la figura nella finestra di Tinker, come faccio a portarla nel codice che sto scrivendo considerato che la finestra che mi appare non ha niente che mi possa trasferire la figura ?. Grazie Saluti Nicola
2008/3/11, enrico franchi <[EMAIL PROTECTED]>: > > 2008/3/11 Nicola Pizzimenti <[EMAIL PROTECTED]>: > > > Vorrei sapere come si costruiscono le figure geometriche piane con > > l'istruzione print. > > Ti sconsiglio questa strada. Se vuoi giocare con le figure > geometriche, usa una libreria grafica. > > Per quello che devi fare suggerisco Tkinter. Ce la dovresti avere con > il Python standard, non è bellissima, ma è piuttosto facile da usare. > > Toh, questo è un abbozzo. Un semplice canvas su cui fai linee. Tasto > sinistro metti un punto, tasto destro pulisci il canvas. > > from Tkinter import * > > class Gui(object): > def __init__(self): > self.root = Tk() > self.canvas = Canvas(self.root) > self.canvas.pack(side=TOP, fill=BOTH, expand=1) > self.points = [] > self.bind_canvas() > > def start(self): > self.root.mainloop() > > def draw(self): > self.canvas.delete(ALL) > self.canvas.create_line(*self.points) > > def bind_canvas(self): > self.canvas.bind('<Button-1>', self.click) > self.canvas.bind('<Button-3>', self.clear) > > def clear(self, event): > self.canvas.delete(ALL) > self.points = [] > > def click(self, event): > self.points.extend([event.x, event.y]) > if len(self.points) >= 4: > self.draw() > > def main(): > g = Gui() > g.start() > > if __name__ == '__main__': > main() > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python >
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python