Python Forum
[Tkinter] Tkinter won't start
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Tkinter won't start
#3
When creating a GUI with tkinter you need to have a single mainloop that is called at the point you want your GUI to run.
It creates an infinite loop that runs until the main tkinter window is destroyed.
The mainloop will draw the GUI widgets and react to events such as button presses, as you have seen without it the GUI doesn't function.
from tkinter import Tk, Canvas
 
root = Tk()
c = Canvas(root, width=800, height=800, bg='black')
c.pack()
c.create_text(100, 50, anchor='w', fill='orange', font='Arial 28 bold underline', text='....')
root.mainloop()
Reply


Messages In This Thread
Tkinter won't start - by uriel - Nov-16-2021, 07:19 PM
RE: Tkinter won't start - by deanhystad - Nov-16-2021, 07:27 PM
RE: Tkinter won't start - by Yoriz - Nov-16-2021, 08:31 PM
RE: Tkinter won't start - by uriel - Nov-17-2021, 02:17 PM
RE: Tkinter won't start - by uriel - Nov-17-2021, 05:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter function to clear old canvas and start a fresh "operation" zazas321 5 9,925 Oct-01-2020, 04:16 AM
Last Post: zazas321

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020