简体   繁体   中英

Binding ttk Entry widget

I am trying to make a bind_class to a ttk Entry widget but it does not work. It only work properly when I bind each Entry widget separately. Would you help me?

Thank you in advance

from tkinter import ttk
from tkinter.ttk import*
from tkinter import *

root = Tk()

def clicker(event):
    myLabel = ttk.Label( root, text = 'You clicked a button' )
    myLabel.pack()

myEntry = ttk.Entry( root )
myEntry.pack()

root.bind_class( 'Entry', '<Button-1>', clicker )

root.mainloop()

When I replaced 'Entry' by 'TEntry' it worked perfectly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM