Antonio
Antonio

Reputation: 1

Opening several canvas windows

I am trying to run a Python code that opens several canvas windows but I do not know how to do it..... opening just one windows looks like the code that I have below...... If I want to put this code inside a for cicle in order to open several independent windows.... how can I do that?

Thanks for your help

 from tkinter import *
 root = Tk()
 root.title("First Graph")
 root.resizable(0,0)
 points = []

 f1 = Canvas(root, bg="white", width=300, height= 300)

 f1.bind("<Motion>", callback)
 f1.configure(cursor="crosshair")
 f1.pack()

 f1.bind("<Button-1>", point)
 f1.bind("<Button-3>", graph)

 root.mainloop()

Upvotes: 0

Views: 53

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385970

Create an instance of Toplevel for every independent window that you want. Then, you can put a canvas or anything else in the toplevel just like you can for the root window.

Upvotes: 1

Related Questions