def set_styles(): """ Sets custom values for DearPy GUI window settings. """ core.set_main_window_size(1500, 900) core.set_style_window_padding(8.00, 8.00) core.set_style_frame_padding(12.00, 4.00) core.set_style_item_spacing(8.00, 2.00) core.set_style_item_inner_spacing(2.00, 1.00) core.set_style_touch_extra_padding(0.00, 0.00) core.set_style_indent_spacing(12.00) core.set_style_scrollbar_size(16.00) core.set_style_grab_min_size(20.00) core.set_style_window_border_size(1.00) core.set_style_child_border_size(1.00) core.set_style_popup_border_size(0.00) core.set_style_frame_border_size(0.00) core.set_style_tab_border_size(0.00) core.set_style_window_rounding(4.00) core.set_style_child_rounding(4.00) core.set_style_frame_rounding(5.00) core.set_style_popup_rounding(4.00) core.set_style_scrollbar_rounding(5.00) core.set_style_grab_rounding(4.00) core.set_style_tab_rounding(5.00) core.set_style_window_title_align(0.50, 0.50) core.set_style_button_text_align(0.50, 0.50) core.set_style_selectable_text_align(0.00, 0.00) core.set_style_display_safe_area_padding(4.00, 4.00) core.set_style_global_alpha(1.00) core.set_style_antialiased_lines(True) core.set_style_antialiased_fill(True) core.set_style_curve_tessellation_tolerance(1.25) core.set_style_circle_segment_max_error(1.60) core.add_additional_font('Karla-Regular.ttf', 20)
def __init__(self): core.set_style_frame_padding(3, 3) core.set_style_window_padding(3, 3) core.set_main_window_size(650, 450) core.set_global_font_scale(1.5) with simple.window("main", autosize=True): with simple.group("panel", width=210): count = max(22, len(_fontnames)) core.add_input_text("regex", label='', default_value=" ") core.add_listbox("font", label='', items=_fontnames, num_items=count, width=210, callback=self.__changed) core.add_same_line() with simple.group("text"): core.add_text( "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\ Phasellus in mollis mauris. Donec tempor felis eget libero accumsan sagittis.\ Integer efficitur urna sed nibh auctor, non hendrerit libero pulvinar.\ Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere\ cubilia curae; In hac habitasse platea dictumst. Vestibulum consectetur,\ sem vitae tristique rhoncus, sem ex maximus ligula, vitae egestas lorem libero\ nec libero. Pellentesque habitant morbi tristique senectus et netus et malesuada\ fames ac turpis egestas. Praesent gravida laoreet pharetra. Ut nec vulputate purus.\ Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos\ himenaeos. Maecenas malesuada neque vel ipsum imperdiet, et lobortis justo sollicitudin.", wrap=560) simple.show_style_editor()
def __init__(self): core.set_style_item_spacing(1, 1) core.set_style_window_padding(0, 0) core.set_main_window_size(690, 450) with simple.window("main"): core.add_drawing("canvas") core.set_resize_callback(self.__resize) core.set_render_callback(self.__render)
def __init__(self): core.set_style_item_spacing(1, 1) core.set_style_window_padding(0, 0) with simple.window("main"): with simple.group("controls", width=520): with simple.group("buttons"): for x in range(6): core.add_button(f"id-{x}", label=f"button {x}") core.add_color_button("bcolor", (196, 128, 155, 255)) core.add_radio_button("radio") core.add_checkbox("checkbox") core.add_same_line() with simple.group("misc"): core.add_date_picker("date") with simple.group("text"): core.add_text("text") core.add_input_text( "input_text", label="", default_value= "Call me Ish-meal. Tasty like an ashen log.") core.add_label_text("label", label="", default_value="label") core.add_same_line() with simple.group("dropdown"): core.add_listbox("listbox", label="", items=(1, 2, 3)) core.add_combo("combo", label="", items=(1, 2, 3)) for x in ["float", "int"]: with simple.group(x): for what in ["add_drag_", "add_input_"]: for y in ['', 2, 3, 4]: n = f"{what}{x}{y}" cmd = getattr(core, n) cmd(n, label="", width=200) core.add_same_line() manager.ThemeManager()
def __init__(self): core.set_style_item_spacing(29, 4) core.set_style_window_padding(0, 0) core.set_main_window_size(1920, 1080) self.__column = 7 self.__row = 58 with simple.window("main"): with simple.group("test", width=187): core.add_button("THE DPG HERO WE NEED...", callback=self.__generate) for c in range(self.__column): core.add_same_line() with simple.group(f"col-{c}", width=187): x = c * self.__row for r in range(self.__row): core.add_text(str(x + r), default_value=" ")
def __init__(self): core.set_style_item_spacing(0, 0) core.set_style_window_padding(0, 0) self.__rows = 0 self.__cap = 0 self.__board = [] self.__width = 0 self.__height = 0 self.__puzzles = {} root = path.dirname(path.realpath(__file__)) for f in listdir(root): full = f"{root}/{f}" if not path.isfile(full) or not f.endswith('.png'): continue who, _ = path.splitext(f) self.__puzzles[who] = full keys = list(self.__puzzles.keys()) self.__puzzle = self.__puzzles[keys[0]] with simple.window("MainWindow", autosize=True): with simple.group("Controls"): for d in [3, 5, 7]: core.add_same_line() core.add_button(f"{d} x {d}", width=120, height=50, callback=self.__clearBoard) core.add_same_line() core.add_dummy() core.add_same_line() core.add_button("Solve!", width=120, height=50, callback=self.__solve) core.add_same_line() items = [p for p in self.__puzzles.keys()] core.add_listbox("selection", items=items, callback=self.__imgChange) self.__clearBoard(self, 3)
def __init__(self): core.set_style_item_spacing(1, 1) core.set_style_window_padding(0, 0) core.enable_docking(shift_only=False, dock_space=True) core.set_main_window_size(690, 450) root = os.path.dirname(__file__) self.__configFile = f'{root}/config.json' with simple.window("main"): with simple.group("test", width=200): core.add_button("button1") core.add_window() with simple.window("floaty", ): with simple.group("test", width=200): core.add_button("button1") core.set_exit_callback(self.__exit) self.__configLoad()
def main(): center_items = [] core.add_data('item_center_list', center_items) with simple.window(TITLE): with simple.menu_bar('##menu_bar'): with simple.menu('File'): # core.add_menu_item('Import', callback=None) # core.add_menu_item('Export', callback=None) with simple.menu('Theme'): themes = ['Dark', 'Light', 'Classic', 'Dark 2', 'Grey', 'Dark Grey', 'Cherry', 'Purple', 'Gold', 'Red'] for theme in themes: core.add_menu_item(theme, callback=menu.update_theme) # core.add_menu_item('Exit', callback=None) with simple.menu('About'): core.add_menu_item('Version', callback=menu.show_version) with simple.group('##input_group'): # Title input core.add_text('Title:') core.add_input_text(TITLE_ID, hint='Enter title', width=WIDGET_WIDTH) core.add_spacing(count=2) # Identifier input core.add_text('Identifier:') core.add_input_text(IDENTIFIER_ID, hint='Enter identifier', width=WIDGET_WIDTH) core.add_spacing(count=2) # Password input core.add_text('Password:'******'Enter password', width=WIDGET_WIDTH) core.add_spacing(count=2) # Note input core.add_text('Note:') core.add_input_text(NOTE_ID, hint='Enter note info', width=WIDGET_WIDTH) core.add_spacing(count=10) # Save button save_clear_spacing = 50 core.add_button('##save', label='Save', callback=input_field.save_password, width=WIDGET_HALF_WIDTH - (save_clear_spacing // 2)) core.set_item_color('##save', core.mvGuiCol_Button, color=GREEN) core.add_same_line(spacing=save_clear_spacing) # Clear input entry button core.add_button('##clear_input', label='Clear input', callback=input_field.clear_input, width=WIDGET_HALF_WIDTH - (save_clear_spacing // 2)) core.add_spacing(count=20) with simple.group('##log_group'): # Logger core.add_logger('##log_message', auto_scroll_button=False, copy_button=False, filter=False, clear_button=False, width=WIDGET_WIDTH, height=80) core.set_log_level(core.mvTRACE, logger='##log_message') core.add_spacing(count=10) # Clear log button core.add_button('##clear_log', label='Clear log', callback=logger.clear_log, width=WIDGET_WIDTH) core.add_spacing(count=10) with simple.group('##password_table_group'): # Password table header = ['No', 'Title', 'Identifier', 'Password', 'Note'] core.add_table('##password_table', header, callback=table.table_printer, height=int(WINDOW_HEIGHT * 0.45), width=WIDGET_WIDTH) core.add_spacing(count=10) table.update_password_table() # Update password table button update_delete_spacing = 20 core.add_button('##update_table', label='Update table', callback=table.update_password_table, width=WIDGET_HALF_WIDTH - (update_delete_spacing // 2)) core.set_item_color('##update_table', core.mvGuiCol_Button, color=BLUE) core.add_same_line(spacing=update_delete_spacing) # Delete password table button core.add_button('##delete_table', label='Delete table', width=WIDGET_HALF_WIDTH - (update_delete_spacing // 2)) core.set_item_color('##delete_table', core.mvGuiCol_Button, color=RED) with simple.popup('##delete_table', '##ask_delete', mousebutton=core.mvMouseButton_Left, modal=True): with simple.group('##delete_table_button_group'): delete_table_spacing = 10 delete_table_half_width = core.get_main_window_size()[1] // 5 - delete_table_spacing core.add_text('##delete_table_button', default_value='Are you sure to delete all data?') core.add_spacing(count=delete_table_spacing) core.add_button('##delete_table_button_yes', label='Yes', callback=table.delete_password_table, callback_data=True, width=delete_table_half_width) core.add_same_line(spacing=delete_table_spacing) core.add_button('##delete_table_button_no', label='No', callback=table.delete_password_table, callback_data=False, width=delete_table_half_width) # TODO WONT WORK NEED TO FIX center_item FUNCTION # center_item('##delete_table_button') # center_item('##delete_table_button_yes') # center_item('##delete_table_button_no') # center_item('##delete_table_button_group') if DEBUG_MODE: # core.show_logger() simple.show_debug() # simple.show_documentation() # Common Configuration core.set_theme(DEFAULT_THEME) core.add_additional_font(FONT, FONT_SIZE) core.set_main_window_title(TITLE) core.set_main_window_size(WINDOW_WIDTH, WINDOW_HEIGHT) core.set_main_window_resizable(RESIZABLE) core.set_style_window_padding(WINDOW_PADDING, WINDOW_PADDING) core.set_exit_callback(model.close_connection) # core.set_render_callback(apply_centering) core.start_dearpygui(primary_window=TITLE)
def __init__(self): core.set_vsync(False) core.set_style_window_padding(0, 0) self.__iteration = 3 # load the data blob root = path.dirname(path.realpath(__file__)) with open(f'{root}/fractal.json', 'r') as data: self.__fractalData = OrderedDict(json.load(data)) self.__fractalKeys = [k for k in self.__fractalData.keys()] d = self.__fractalKeys[0] self.__fractal = Fractal(**self.__fractalData[d]) size = core.get_main_window_size() with simple.window("MainWindow"): with simple.group("Controls"): core.add_input_int("Iteration", width=120, min_value=2, max_value=40, min_clamped=True, max_clamped=True, default_value=self.__iteration, callback=self.__cbIterationValue) simple.tooltip( "Iteration", "How many times to re-run the pattern parser with the \ previous runs output. Increasing this directly increases computation time." ) with simple.group("Controls-Angle"): core.add_input_float("Angle", width=120, default_value=self.__fractal.dAngle, callback=self.__cbAngleValue) simple.tooltip( "Angle", "Degrees the turtle will turn either positive or negative, when issued such commands." ) core.add_same_line() core.add_checkbox("AngleAnimate", default_value=False, label="Animate") core.add_input_float("AngleStep", width=120, default_value=.002, step=0.001, step_fast=0.01) simple.tooltip( "AngleStep", "Amount the animator will step through the angle.") core.add_input_float("Length", width=120, default_value=self.__fractal.delta, callback=self.__cbDeltaValue) simple.tooltip( "Length", "Relative distance, forward or backward, the turtle will take when commanded." ) core.add_same_line() core.add_listbox("power", label='', items=self.__fractalKeys, callback=self.__cbFractalType) core.add_drawing("Canvas", width=size[0] * 2, height=size[1] * 2) core.set_resize_callback(self.__resize) core.set_render_callback(self.__render) self.__refresh()
dwmapi = ctypes.WinDLL("dwmapi") DWMWA_CLOAKED = 14 isCloacked = c_int(0) from dearpygui.core import set_main_window_size, set_global_font_scale, set_theme, set_style_window_padding, get_value, \ set_value, add_spacing, add_text, add_slider_int, add_menu_item, add_button, start_dearpygui, set_start_callback, \ mvMouseButton_Left, close_popup, set_main_window_title, add_window, end, delete_item from dearpygui.simple import set_window_pos, window, menu, popup PREF_FILE_NM = 'Auto Pots preferences.json' SCREEN_WIDTH = 640 set_main_window_size(SCREEN_WIDTH, 500) set_global_font_scale(1.5) set_theme("Gold") set_style_window_padding(30, 30) def get_active_windows(): def enum_cb(hwnd, results): if win32gui.IsWindowVisible(hwnd) and win32gui.GetWindowText(hwnd) != '': dwmapi.DwmGetWindowAttribute(HWND(hwnd), DWORD(DWMWA_CLOAKED), ctypes.byref(isCloacked), ctypes.sizeof(isCloacked)) if (isCloacked.value == 0): results.append((hwnd, win32gui.GetWindowText(hwnd))) toplist, winlist = [], [] win32gui.EnumWindows(enum_cb, toplist) filtered_titles = [] for hwnd, title in toplist: try: