Closed lennartfrankde closed 5 months ago
The value returned by generate_uuid
is a numeric UUID. DPG accepts both numeric UUIDs and string tags to identify items; however, the string tags must be assigned explicitly as such when you create items (and in this case, the item will still have a uniquie numeric ID; the string tag is just an alias).
When you do add_selectable(tag=self.tableObjects[a][b][c][d])
, you're asking DPG to create an item with a specific numeric ID, and it does so by simply assigning the UUID you passed (134
) and not generating a new one.
Then, when you do dpg.set_value(str(self.tableObjects[a][b][c][d]))
, you're asking DPG to find an item with a string tag "134"
rather than a numeric ID 134
. There's no such item because none of the were added with tag="134"
.
All you need to do is to remove that str()
around self.tableObjects[a][b][c][d]
.
P.S. Next time you open an issue in this project, please make an effort to read the issue template and follow it. Proper description helps a lot in diagnosing the issue, as well as shows your respect to the time of whoever does that diagnostics.
Thanks for your quick response, next time I will use the Issue format I just was unsure wich one is the right, and I wasn't able to find a template, wich was probably my fault, so after I made these changes:
dpg.set_value(self.tableObjects[a][b][c][d], True)
The code doesn't gives out a error anymore, but what I tried to do is to change the label of the item, is that in any way possible? (It is a selectable Table)
with dpg.window(tag="Selectable Tables"):
with dpg.table(tag="SelectCells", header_row=False) as selectablecells:
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
for i in range(9):
with dpg.table_row():
for j in range(9):
if i < 3: a = 0
elif i <6: a = 1
else: a = 0
if j < 3: b = 0
elif j <6: b = 1
else: b = 0
if i == 0 or i == 3 or i == 7: c = 0
elif i == 1 or i == 4 or i == 8: c = 1
else: c = 2
if j == 0 or j == 3 or j == 7: d = 0
elif j == 1 or j == 4 or j == 8: d = 1
else: d = 2
text = "#" if self.board[a][b][c][d] == " " else self.board[a][b][c][d]
self.tableObjects[a][b][c][d] = uuid = dpg.generate_uuid()
dpg.add_selectable(label=f"{text}", callback=self.clb_selectable, user_data=(a, b, c, d), tag=self.tableObjects[a][b][c][d])
if i == 2 or i == 5:
with dpg.table_row():
for j in range(9):
dpg.add_selectable(label=f"---", callback=self.clb_selectable, user_data=(99,99))
Try dpg.set_item_label
.
Regarding the template, it's what appears in the description field when you open a new ticket. Maybe you were opening this ticket in a non-standard way, not sure.
ups enter...
-> self.tableObjects is the uuid in this case 134
So like I generate and save a uuid for every cell so I can edit its contents, but when I try to edit the Labels i get that error