Jan-14-2022, 05:17 PM
(This post was last modified: Jan-14-2022, 05:50 PM by Yoriz.
Edit Reason: Added prefix
)
Updating a class attribute from a Kivy Textinput.text copies over an unexpected format.
Below i am sorting through the child widgets to expose the one to modify.
The children are a class that inherits Kivy Button with several attributes added.
When the objects are created, the attribute data is supplied from a data table.
To edit, the attribute data is displayed in the Kivy Textinput's.
After editing, it is copied back to update the objects attributes.THIS IS WHEN THE FORMAT CHANGES- or gets included.
For example, in animal.tagNo=self.cow_detBtn['tag'].text, the right hand side may show '44' but after executed, the left hand side shows ('44', ).
So i must not be getting just the value. I have looked into stripping/replacing but not sure that will work here.
I have discovered the widget's attributes are a tuple. How do I get at updating the value? In other places in the program, I have the ability to use the instance passed by the on_press event which works as expected. ie
Problem resolved.
In a cut and paste i missed removing the "," from the end of the lines which made it look like a tuple.
Below i am sorting through the child widgets to expose the one to modify.
The children are a class that inherits Kivy Button with several attributes added.
When the objects are created, the attribute data is supplied from a data table.
To edit, the attribute data is displayed in the Kivy Textinput's.
After editing, it is copied back to update the objects attributes.THIS IS WHEN THE FORMAT CHANGES- or gets included.
For example, in animal.tagNo=self.cow_detBtn['tag'].text, the right hand side may show '44' but after executed, the left hand side shows ('44', ).
So i must not be getting just the value. I have looked into stripping/replacing but not sure that will work here.
for animal in self.loc_tabs[self.myCow.loc].content.children: if animal.type=="Cow": if str(animal.tagNo)==self.myCow.tagNo: if animal.tagClr==self.myCow.tagClr: if str(animal.tagYr)==self.myCow.tagYr: # update cow widget animal.tagNo=self.cow_detBtn['tag'].text, animal.tagClr=self.cow_detBtn['tagClr'].text, animal.tagYr=self.cow_detBtn['tagYr'].text, animal.type=self.cow_detBtn['type'].text,
I have discovered the widget's attributes are a tuple. How do I get at updating the value? In other places in the program, I have the ability to use the instance passed by the on_press event which works as expected. ie
instance.tagNo=self.cow_detBtn['tag'].text
.Problem resolved.
In a cut and paste i missed removing the "," from the end of the lines which made it look like a tuple.