I am creating a dynamic checkbox that fetches the column names from any csv file, But i'm not able to clear the window after selecting the options.
This is a sample code containing the list with few names...
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 2 16:20:54 2016
------------------------Tkinter-------------------------
@author: Suresh
"""
import tkinter as tk
from tkinter import ttk #themed tk
win = tk.Tk()
win.title("py")
win.geometry("970x500")
win.configure()
#selection_frame = Frame(tk)
alabel = ttk.Label(win, text="Demo CheckBox",anchor='center')
alabel.grid(column=70, row=0)
alabel.configure(foreground='darkblue')
global check_box
def clearwindow():
check_box.grid_forget()
feat_names = ['Tv','Radio','Newspaper','Internet','Transport','Sports']
for i in range(len(feat_names)):
feat = tk.StringVar()
check_box = tk.Checkbutton(win, text=feat_names[i], variable=feat, state ='normal')
check_box.grid(column=30, row=i+14, sticky=tk.W)
check_box.deselect()
action = ttk.Button(win, text="Submit", command=clearwindow)
action.grid(column=4, row=30)
win.mainloop()
I want to get a clear window as soon as i click on the submit button.
Plz help!!
Aucun commentaire:
Enregistrer un commentaire