-
Notifications
You must be signed in to change notification settings - Fork 1
6. Tutorial ‐ Hello World (Preparing UI for interaction)
Rigved Maanas edited this page May 5, 2024
·
1 revision
In this tutorial you will learn how to prepare the UI for interaction
Since we need the button in the UI to trigger a command on click, we need to change it's name to a more suitable one.
- Click on the added button in the viewport.
- Change the option
ID
toclick_me_button
in the Geometry & Content Menu from the Properties Panel
- Click on
Export Code
button from the tool bar. - In the popup window you can preview the generated code.
- Choose OOP or No OOP in the left hand side of the popup window. (For this tutorial choose
No OOP
but we recommend usingOOP
) - Click on the button
Export Code
in the popup window. - Name your python file in the popup window and give it a destination.
You can now access your button through the variable click_me_button
- Open your python file in your favourite editor
- In order to print
Hello World
on click, add the following code beforeroot.mainloop()
.
click_me_button.configure(command=lambda: print("Hello World"))
Well Done 👍 You have successfully completed the tutorial. We wish you to create better UI's from now on ⭐