Python Forum
tkinter.TclError: bad window path name
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter.TclError: bad window path name
Hi all,
I am getting the error _tkinter.TclError: bad window path name ".!toplevel.!frame.!combobox
When I click on the "Columns" button the first time, it opens up a new window no problem.
When I click on the "Exit" button to close out the window and click on the "Columns" button again, I get the bad window error.
It is failing on line 19: column_values[i][j].grid(row=i,column= j)
Below is the code.
Any help would be appreciated.
Thanks in advance.

from tkinter import *
from tkinter import ttk
import tkinter.font as font

def get_columns(field_names):
    new_window = Toplevel(mw)
    new_window.wm_title("Select Columns")

    frame3 = Frame(new_window)
    framebot = Frame(new_window)

    for i in range(0,max_columns):
      j = 0
      column_values[i][j].grid(row=i,column= j)

    exit_button = Button(framebot,text='Exit',font=("Times",16),command=new_window.destroy).pack(side="right")

# Start the main program here
if __name__ == "__main__":
    current_file = __file__

    frame1 = Frame(mw)
    framebot = Frame(mw)

    w1 = Label(frame1, text="Database Name: ",font=("Times",16)).pack(side="left")
    dbase = StringVar()
    a1 = ttk.Combobox(frame1,width=40,font=("Times",16),textvar=dbase)

    field_names = ["A.a","B.b","C.c"]
    max_columns = 10
    column_values = []

    btn2 = Button(framebot,text='Columns',font=("Times",16),command=lambda: get_columns(field_names)).pack(side="left")
    btn6 = Button(framebot,text='Exit',font=("Times",16),command=mw.quit).pack(side="right")


Messages In This Thread
tkinter.TclError: bad window path name - by kenwatts275 - Apr-25-2020, 08:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  function in new window (tkinter) Dale22 7 180 Nov-24-2020, 11:28 PM
Last Post: Dale22
  Scrollable big image in a window (TKinter) Prospekteur 3 262 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  [Tkinter] Python - Tkinter : How can I send path Excel from GUI to scripte johnjh 2 541 Aug-28-2020, 05:38 PM
Last Post: maaad
  Run more than one window together with tkinter SmukasPlays 1 257 Aug-24-2020, 05:00 PM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 790 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  [Tkinter] _tkinter.TclError: bitmap "Icon.gif" not defined djwilson0495 2 791 Aug-05-2020, 02:27 PM
Last Post: wuf
  [Tkinter] calling a new window from a tkinter window neuroprogrammer 2 347 Jul-28-2020, 10:59 PM
Last Post: deanhystad
  How to display results from terminal window onto tkinter. buttercup 0 234 Jul-21-2020, 04:41 AM
Last Post: buttercup
  [Tkinter] bad window path name jdos 6 549 Jun-25-2020, 06:25 AM
Last Post: jdos
  [Tkinter] _tkinter.TclError: image "pyimage2" doesn't exist Killdoz 1 1,317 May-30-2020, 09:48 AM
Last Post: menator01

Forum Jump:

User Panel Messages

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