step 3: add widget shell sizing and frame pump
This commit is contained in:
27
examples/basic_map.py
Normal file
27
examples/basic_map.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Any
|
||||
|
||||
import dearpygui.dearpygui as _dpg
|
||||
|
||||
import dpg_map as dpgm
|
||||
|
||||
dpg: Any = _dpg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map basic", width=900, height=600)
|
||||
|
||||
with (
|
||||
dpg.window(label="Map", width=-1, height=-1),
|
||||
dpgm.map_widget(tag="map", center=(47.9029, 1.9093), zoom=15, width=-1, height=-1),
|
||||
):
|
||||
dpgm.add_marker("vehicle", lat=47.9029, lon=1.9093)
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
27
examples/hidden_tab.py
Normal file
27
examples/hidden_tab.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Any
|
||||
|
||||
import dearpygui.dearpygui as _dpg
|
||||
|
||||
import dpg_map as dpgm
|
||||
|
||||
dpg: Any = _dpg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map hidden tab", width=900, height=600)
|
||||
|
||||
with dpg.window(label="Hidden Tab Sizing", width=-1, height=-1), dpg.tab_bar():
|
||||
with dpg.tab(label="First"):
|
||||
dpg.add_text("Switch to the map tab.")
|
||||
with dpg.tab(label="Map"), dpgm.map_widget(tag="map-hidden-tab", width=-1, height=500):
|
||||
dpgm.add_marker("tab-marker", lat=35.0, lon=139.0)
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
28
examples/sizing_child.py
Normal file
28
examples/sizing_child.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from typing import Any
|
||||
|
||||
import dearpygui.dearpygui as _dpg
|
||||
|
||||
import dpg_map as dpgm
|
||||
|
||||
dpg: Any = _dpg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map child sizing", width=900, height=600)
|
||||
|
||||
with (
|
||||
dpg.window(label="Nested Child", width=-1, height=-1),
|
||||
dpg.child_window(width=-1, height=420),
|
||||
dpgm.map_widget(tag="map-child", width=-1, height=-1),
|
||||
):
|
||||
dpgm.add_marker("inside-child", lat=47.0, lon=2.0)
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
33
examples/sizing_table.py
Normal file
33
examples/sizing_table.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from typing import Any
|
||||
|
||||
import dearpygui.dearpygui as _dpg
|
||||
|
||||
import dpg_map as dpgm
|
||||
|
||||
dpg: Any = _dpg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map table sizing", width=1000, height=600)
|
||||
|
||||
with (
|
||||
dpg.window(label="Table Layout", width=-1, height=-1),
|
||||
dpg.table(header_row=True, resizable=True, policy=dpg.mvTable_SizingStretchProp),
|
||||
):
|
||||
dpg.add_table_column(label="Map")
|
||||
dpg.add_table_column(label="Controls")
|
||||
with dpg.table_row():
|
||||
with dpg.table_cell(), dpgm.map_widget(tag="map-table", width=-1, height=500):
|
||||
dpgm.add_marker("table-marker", lat=51.5, lon=-0.1)
|
||||
with dpg.table_cell():
|
||||
dpg.add_text("Resize the window and table columns.")
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
27
examples/sizing_window.py
Normal file
27
examples/sizing_window.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Any
|
||||
|
||||
import dearpygui.dearpygui as _dpg
|
||||
|
||||
import dpg_map as dpgm
|
||||
|
||||
dpg: Any = _dpg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map window sizing", width=900, height=600)
|
||||
|
||||
with (
|
||||
dpg.window(label="Fill Window", width=-1, height=-1),
|
||||
dpgm.map_widget(tag="map-window", width=-1, height=-1),
|
||||
):
|
||||
dpgm.add_marker("center", lat=0.0, lon=0.0)
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user