Reputation: 31
I'm new to Tkinter, Python and Linux. I'm running Ubuntu 19.04 and trying to run my Python-Tkinter code in Atom, but when I run it, only terminal shows up with an information about successful execution and execution time. No canvas appears.
import tkinter
canvas = tkinter.Canvas(width=200, height=200, bg="white")
canvas.pack()
canvas.create_line(0,0,100,100)
I expect new window with canvas and line to appear, but that doesn't happen, I only get terminal saying:
Process returned 0 (0x0) execution time : 0.307 s
Press [ENTER] to continue...
Thank you for your help.
Upvotes: 1
Views: 224
Reputation: 31
Like PRMoureu and furas said, I only added canvas.mainloop()
at the end and that solved my problem! Thank them!
import tkinter
canvas = tkinter.Canvas(width=200, height=200, bg="white")
canvas.pack()
canvas.create_line(0,0,100,100)
canvas.mainloop()
Upvotes: 1