Python Forum
[Tkinter] Top Level Window - from tkinter import *
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Top Level Window - from tkinter import *
#4
import tkinter as tk is the preferred way of importing, see https://python-forum.io/Thread-Namespace...th-imports
you should only need one root.mainloop()
The error is because you are trying to use from tkinter import * inside a function
Imports should go at the start of your python file.

It looks like you have put two separate windows codes together in a way which they shouldn't be.
Reply


Messages In This Thread
RE: Top Level Window - from tkinter import * - by Yoriz - Apr-23-2019, 08:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 545 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  Tkinter multiple windows in the same window tomro91 1 872 Oct-30-2023, 02:59 PM
Last Post: Larz60+
  Centering and adding a push button to a grid window, TKinter Edward_ 15 4,919 May-25-2023, 07:37 PM
Last Post: deanhystad
Lightbulb [Tkinter] Tkinter Class Import Module Issue AaronCatolico1 6 3,154 Sep-06-2022, 03:37 PM
Last Post: AaronCatolico1
  [Tkinter] Open tkinter colorchooser at toplevel (so I can select/focus on either window) tabreturn 4 1,931 Jul-06-2022, 01:03 PM
Last Post: deanhystad
  [Tkinter] Background inactivity timer when tkinter window is not active DBox 4 2,948 Apr-16-2022, 04:04 PM
Last Post: DBox
  why my list changes to a string as I move to another window in tkinter? pymn 4 2,586 Feb-17-2022, 07:02 AM
Last Post: pymn
  [Tkinter] Tkinter Window Has no Title Bar gw1500se 4 2,873 Nov-07-2021, 05:14 PM
Last Post: gw1500se
  "tkinter.TclError: NULL main window" Rama02 1 5,882 Feb-04-2021, 06:45 PM
Last Post: deanhystad
  function in new window (tkinter) Dale22 7 5,199 Nov-24-2020, 11:28 PM
Last Post: Dale22

Forum Jump:

User Panel Messages

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