Upgrading some Eto.Forms from IronPython to Python3 - noticing a few changes which are easy to resolve - but stumped when needing to add rows to a table. Adding self. seems to solve a lot of
problems, but it doesn’t resolve when adding a row.
The self.table00.Rows.Add(label00a) will respond with an error regardless of having self. or not. Has method of adding table rows changed between the two versions of Python?
Error: AttributeError: ‘0, Culture=neutral, PublicKeyToken=7cec85d7bea77’ object has no attribute ‘table00’
On line 25 you call self.CreateTable00() which moves execution to line 39 in the function CreateTable00. Then before creating the table00 object, you already try to use it on line 47, so the attribute table00 is not yet created on the self object, hence the error message.
I suggest you add this on line 46:
46: self.table00 = Eto.Forms.TableLayout() # create the table
47: self.table00.Rows.Add(label00a)
As for your question, working with a TableLayout you need to create objects of type TableRow which can contain items of type TableCell. In the cells you can store UI elements. Your code would then become something like this: