mercredi 13 décembre 2017

Value gets vanished when i check a checkbox in Tkinter

When I check a checkbox in Tkinter the value of checkbox gets vanished.This problem appears in Linux only.The same code I am using in windows and it is working Fine.

I Referred this link to make this gui How to create a tree view with checkboxes in Python

Code:

import Tkinter as tk

import Tix as tix

def  selectItem(item):

    if cl.getstatus(item) == 'on':
        print("Checked")
    if cl.getstatus(item) == 'off':
        print("Unchecked")

root = tix.Tk()
cl = tix.CheckList(root,browsecmd=selectItem)
cl.pack()
cl.hlist.add("CL1", text="Test")
cl.setstatus("CL1","off")
cl.hlist.add("CL1.Item1", text="child")
cl.setstatus("CL1.Item1","off")
root.mainloop()

Before checked Output

enter image description here

After checked Output

enter image description here

As you can see in the image that checkbox Test disappears after click on Test.This problem is happening only in Linux.Can anyone Give me any Solution ?




Aucun commentaire:

Enregistrer un commentaire