Skip to content
Advertisement

Everytime button is clicked store value in a different variable python tkinter

Hello I am trying to write a chatbot which takes the follow input : name and last name The idea is that when the user click the “Send” button the input is stored in a “name” variable. The text box is cleared and when the user click the button again the new input should go into another variable “lastname”. How can I achieve that? I would like to print “Hello name + lastname” inside the chatbot’s GUI

This is what I have so far :

JavaScript

Advertisement

Answer

I looked at your problem and organized your code. you can solve the problem by creating another function and calling it in get(). you can check if a variable is empty with the stament len(). then your code will be like this:

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