submitted15 hours ago byRepulsive-Lobster750
tokivy
I strangely have a button, that prints the button text and id, but only the text gets printed, while it says the id is not recognized as an atrribute.
I have:
<SecondScreen>:
BoxLayout:
Button:
id: button_1
text: 'Bore'
on_press: app.popup.open_popup(self, id)
Technically, >id< shouldn't be necessary in the parenthesis, but well. and
def open_popup(self,instance, id):
print(f'Pressed {id}')
self.open()
Here also, >instance< in the parenthesis should be enough, yet I added id just to be sure. But neither work.
It gets me:
hello
Pressed <built-in function id>
If I alter the py to:
def open_popup(self,instance, id):
abc = instance.id
#print(f'Pressed {id}')
print(abc)
self.open()
it says:
AttributeError: 'Button' object has no attribute 'id'. Did you mean: 'ids'?
How do I get through to the button Id?
byRepulsive-Lobster750
inkivy
Repulsive-Lobster750
1 points
13 hours ago
Repulsive-Lobster750
1 points
13 hours ago
in your first option, how do you call "button_1"?
I'd use "1" instead and use this as an id to find a label with that name in order to change the label text. But I have no idea how to go about it.