I can’t get through the initial walkthrough. Brand new to Python and I want to remove the bottom orange text area that says do this 3-minute walkthrough.
I’m having trouble when it comes to programming the button portion. It says to add this button click function
def button_1_click(self, **event_args):
“”“This method is called when the button is clicked”""
pass
self.message_label.text = ‘Hello,’ + self.name_box.text
Make sure your function is laid out like this :
def button_1_click(self, **event_args):
“”“This method is called when the button is clicked”""
self.message_label.text = 'Hello,' + self.name_box.text
The indentation is essential in Python to mark the block of code.
Python functions cannot be empty, so “pass” is used to fulfil that criteria until you have “proper” code to put in there. It is not necessary when you have some code in there, and (I think) if you put it before the code you want to run, it exists the function at that point, though I’ve not tested that.
1 Like
Also make sure the double quotes are double quotes. I see that in the text you pasted here some were converted from plain "
to open “
or close ”
double quotes (the IDE doesn’t do that, Word or other text editors do it to do you a favor )
2 Likes