-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main : main : added window transparency example for WIndows
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
''' | ||
If you are using a primary window, this will work. See combo_box_custom_2.py for a | ||
version that works with floating windows. | ||
''' | ||
|
||
import dearpygui.dearpygui as dpg | ||
dpg.create_context() | ||
|
||
def show_options(sender): | ||
x,y = dpg.get_item_pos(sender) | ||
dpg.configure_item("options_window", pos=(x,y+20)) | ||
dpg.configure_item("options_window", show=True) | ||
|
||
with dpg.window(popup=True, show=False, tag="options_window"): | ||
dpg.add_checkbox(label="Option 1") | ||
dpg.add_checkbox(label="Option 2") | ||
dpg.add_checkbox(label="Option 3") | ||
|
||
with dpg.window(width=500, height=300): | ||
dpg.set_primary_window(dpg.last_item(), True) | ||
dpg.add_button(label="Options V", width=100, callback=show_options) | ||
|
||
dpg.create_viewport(width=800, height=600, title='Custom combo box with primary window') | ||
dpg.setup_dearpygui() | ||
dpg.show_viewport() | ||
dpg.start_dearpygui() | ||
dpg.destroy_context() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
''' | ||
If you are not using a primary window, you need to check the position of the window | ||
the button is in and add this on. | ||
''' | ||
|
||
import dearpygui.dearpygui as dpg | ||
dpg.create_context() | ||
|
||
def show_options(sender): | ||
wx, wy = dpg.get_item_pos("window") | ||
x,y = dpg.get_item_pos(sender) | ||
dpg.configure_item("options_window", pos=(wx+x,wy+y+20)) | ||
dpg.configure_item("options_window", show=True) | ||
|
||
with dpg.window(popup=True, show=False, tag="options_window"): | ||
dpg.add_checkbox(label="Option 1") | ||
dpg.add_checkbox(label="Option 2") | ||
dpg.add_checkbox(label="Option 3") | ||
|
||
with dpg.window(width=500, height=300, tag="window"): | ||
dpg.add_button(label="Options V", width=100, callback=show_options) | ||
|
||
dpg.create_viewport(width=800, height=600, title='Custom combo box with floating window') | ||
dpg.setup_dearpygui() | ||
dpg.show_viewport() | ||
dpg.start_dearpygui() | ||
dpg.destroy_context() |