Buttons in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Buttons in python

I have wrote a script thats a virtual vending machine. How can i turn the script into an app alike ? I meant the buttons how do u creat a button that lead to a function?

30th Jul 2020, 5:01 PM
Brosk
Brosk  - avatar
3 Answers
+ 3
Brosk Jako here is a small python calculator I made sometime back... look inside the textarea / python code and the inputs at the top part of the python code and the buttons. https://code.sololearn.com/W7ITsQjn96yK/?ref=app
30th Jul 2020, 5:23 PM
BroFar
BroFar - avatar
+ 3
You can try various python modules/libraries that allow you to make a GUI. In your case I recommend you to use Tkinter/Pygame to simulate a virtual vending machine. Creating buttons is very easy with Tkinter. https://www.tutorialspoint.com/python/tk_button.htm If you want to simulate a whole vending machine process i would recommend you to use pygame for the whole process as its better with animations etc.
30th Jul 2020, 5:14 PM
Muneeb Bhalli
Muneeb Bhalli - avatar
+ 2
Thanx alot :))
31st Jul 2020, 3:44 PM
Brosk
Brosk  - avatar