hoffstadt / hoffstadt/DearPyGui

Table not honoring pos= keyword

Open
#1,819 1 comment 2 reactions 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

## Version of Dear PyGui

Version: 1.6.2
Operating System: Windows 10, Opensuse Tumbleweed

## My Issue/Question

When attempting to position a table at a specific spot in the window using the pos keyword, the table seems to ignore the keyword and is placed "next in line" within the window layout. If, for example, pos=(100,100) is given, in an empty window it will be placed at (0,0). It will, however, report (100,100) if queried with get_item_position().

#.# To Reproduce

Steps to reproduce the behavior:

Sample code provided.

## Expected behavior

The table should be started at (0,100), rather than placed in the normal flow of the layout, as it is now.

## Screenshots/Video

## Standalone, minimal, complete and verifiable example

```python
import dearpygui.dearpygui as dpg
import random
import string

def generate_entries():
entries = []
for x in range(1, 1000):
entry = {}
for y in ["A", "B", "C", "D", "E"]:
entry[y] = "".join(random.SystemRandom().choices(string.ascii_uppercase, k=6))
entries.append(entry)
return entries

def draw_result_table(results, parent):
table = dpg.add_table(header_row=True, parent=parent, pos=(0,100))
dpg.add_table_column(label="A", parent=table)
dpg.add_table_column(label="B", parent=table)
dpg.add_table_column(label="C", parent=table)
dpg.add_table_column(label="D", parent=table)
dpg.add_table_column(label="E", parent=table)
if results:
row_count = 0
for row in results:
row_count += 1
with dpg.table_row(parent=table):
dpg.add_button(
tag="row" + str(row_count), label=row["A"], width=100, callback=cb_click_me, user_data=row
)
dpg.add_text(row["B"])
dpg.add_text(row["C"])
dpg.add_text(row["D"])
dpg.add_text(row["E"])
return table

def cb_click_me():
print("I was clicked!")

def main():
dpg.create_context()
dpg.create_viewport(title="TestPos", width=1500, height=800, decorated=True)

with dpg.window(tag="main", label="Window Test"):
dpg.add_menu_bar()
results = generate_entries()
table = draw_result_table(results, "main")
print(dpg.get_item_pos(table))
dpg.set_primary_window("main", True)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

if __name__ == "__main__":
main()

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.