Skip to content
Advertisement

Update a Label while the app is running without a button on Tkinter

I want to make a label that keeps counting how many times the user typed a certain word(in this case “1r#”) in a ScrolledText without needing to make a button to update the label. Can I make a loop? If so, how could I do it?

JavaScript

Every word the program will look for are three characters long, if it helps.

Advertisement

Answer

You don’t need another loop. Simply, bind <KeyPress> to a function then update the count.

See the example below:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement