Exemplo n.º 1
0
    def run(self):
        """
        A very basic stand-aloen run method to show what this looks like by default
        :return: General number display example
        """
        base = BaseGUI(development=True)
        base.initialize_base_screens()
        window_args = dict(
            autosize=False,
            height=250,
            width=900,
            x_pos=0,
            y_pos=0,
            no_title_bar=True,
            no_resize=True,
            no_move=True,
            no_background=False,
        )
        with s.window("single_cell", **window_args):
            with s.group(name="timergroup", horizontal=True):
                self.build_number_box()

        self.render(Digit.num_8, 8)

        c.start_dearpygui()
    def run(self):
        """
        Creates component and starts DearPyGui.
        """

        self.create_component()
        c.start_dearpygui()
def example_one():
    """
    Creates window plus execution callback ready to take input commands
    """
    def execute(*_args):
        """
        Executes arbitrary command input in running program
        :param _args: This catches sender and data arguments that we aren't using here
        :return: None, executes command
        """
        command = c.get_value("command##input")
        exec(command)

    with s.window(
            name="command##window",
            autosize=True,
            x_pos=0,
            y_pos=0,
    ):
        c.add_input_text(
            name="command##input",
            width=500,
            height=300,
            multiline=True,
            on_enter=True,
            callback=execute,
        )

    c.start_dearpygui()
    def run(self):
        """
        A very basic stand-aloen run method to show what this looks like by default
        :return: General number display example
        """

        window_args = dict(
            autosize=False,
            height=200,
            width=200,
            x_pos=0,
            y_pos=0,
        )
        with s.window("Drawing", **window_args):
            c.add_drawing(self.name, width=90, height=150)

        with s.window(
                "command##window",
                autosize=True,
                y_pos=200,
                x_pos=0,
        ):
            c.add_input_text(
                name="command##input",
                width=600,
                height=300,
                multiline=True,
                on_enter=True,
                callback=self.execute,
            )

        c.start_dearpygui()
Exemplo n.º 5
0
def main():
    parser = argparse.ArgumentParser(
        description="Winsnap: Snap windows into a customizable grid")
    parser.add_argument("--debug",
                        action="store_true",
                        help="Show the log window")
    args = parser.parse_args()
    main_window = MainWindow()

    def mouse_click_cb(sender, data):
        main_window.refresh_windows()

    def startup_cb(sender, data):
        main_window.load()

    dpg_core.set_mouse_click_callback(mouse_click_cb)
    dpg_core.set_start_callback(startup_cb)
    dpg_core.set_resize_callback(main_window.resize_callback,
                                 handler="Main Window")
    scale = ctypes.windll.shcore.GetScaleFactorForDevice(0) / 100
    dpg_core.set_global_font_scale(scale)
    w, h = dpg_core.get_main_window_size()
    dpg_core.set_main_window_size(int(w * scale), int(h * scale))
    dpg_core.set_main_window_title("WinSnap")
    if args.debug:
        dpg_core.show_logger()
    dpg_core.start_dearpygui(primary_window="Main Window")
    def show(self):
        """Start the gui."""
        dpg.set_main_window_size(550, 550)
        dpg.set_main_window_resizable(False)
        dpg.set_main_window_title("Dearpygui Todo App")

        dpg.add_text("Todo App")
        dpg.add_text(
            "Add a todo by writing a title and clicking"
            " the add todo button",
            bullet=True)
        dpg.add_text("Toggle a todo by clicking on its table row", bullet=True)
        dpg.add_text(
            "Remove a todo by clicking on its table row and clicking"
            " the remove todo button",
            bullet=True)
        dpg.add_separator()

        dpg.add_spacing(count=10)
        dpg.add_input_text("New Todo Title", source="new-todo-title")
        dpg.add_button("Add todo", callback=self.__add_todo)
        dpg.add_spacing(count=10)
        dpg.add_separator()

        dpg.add_table('Todos', ['ID', 'Content', 'Done'],
                      height=200,
                      callback=self.__toggle_todo)
        dpg.add_separator()
        dpg.add_text("Selected todo:")
        dpg.add_button("Remove todo", callback=self.__remove_todo)
        dpg.add_button("Clear todos", callback=self.__clear_todos)

        # Render Callback and Start gui
        dpg.set_render_callback(self.__render)
        dpg.start_dearpygui()
Exemplo n.º 7
0
def start(HOST, PORT):
    #Create the network
    console_client.client = console_client.Client(HOST, PORT)
    network_thread = threading.Thread(target=console_client.client.connect)
    network_thread.start()

    #Start up gui
    start_up.start()

    #Runtime
    core.start_dearpygui()
Exemplo n.º 8
0
    def show(self):
        """Start the gui."""
        with sdpg.window("Main Window"):
            dpg.set_main_window_size(550, 600)
            dpg.set_main_window_resizable(False)
            dpg.set_main_window_title("Stockify")

            dpg.add_text("Stockify: The Future of Stocks")
            dpg.add_text(
                "Predict a stock by typing in its ticker and clicking"
                " the predict stock button",
                bullet=True,
            )
            dpg.add_text(
                "Remove a stock by clicking on its table row and clicking"
                " the remove stock button",
                bullet=True,
            )
            dpg.add_text(
                "All predictions will predict a stocks value "
                "in 30 days",
                bullet=True,
            )

            dpg.add_text(
                "Confidence is the degree that Stockify"
                " is sure about its prediction",
                bullet=True,
            )
            dpg.add_separator()

            dpg.add_spacing(count=10)
            dpg.add_input_text("Stock Ticker", source="stock-ticker")
            dpg.add_button("Predict Stock", callback=self.__add_stock)
            dpg.add_spacing(count=10)
            dpg.add_separator()

            dpg.add_table(
                "Stocks",
                ["Stock", "Prediction", "Confidence"],
                height=200,
                callback=self.__toggle_stock,
            )
            dpg.add_separator()
            dpg.add_text("Selected stock:")
            dpg.add_button("Remove stock", callback=self.__remove_stock)
            dpg.add_button("Clear stocks", callback=self.__clear_stocks)

            # Render Callback and Start gui
            dpg.set_render_callback(self.__render)
        dpg.start_dearpygui(primary_window="Main Window")
Exemplo n.º 9
0
    def show(self):
        """Start the gui."""
        with sdpg.window("Main Window"):
            dpg.set_main_window_size(550, 650)
            dpg.set_main_window_resizable(False)
            dpg.add_spacing()
            dpg.set_main_window_title("Dearpygui File Zip")

            dpg.add_spacing()
            dpg.add_text("File Zip App")
            dpg.add_spacing()
            dpg.add_text("Select files to zip by adding them to the table",
                         bullet=True)
            dpg.add_text("Set the output directory", bullet=True)
            dpg.add_text("Click on the table to remove a file", bullet=True)
            dpg.add_text("Click on the zip files button to zip all the files",
                         bullet=True)
            dpg.add_text(
                "If you do not choose a directory, it will by default be"
                "the same directory from where you've run this script.",
                bullet=True)
            dpg.add_spacing()
            dpg.add_separator()

            dpg.add_spacing(count=10)
            dpg.add_button("Select output directory",
                           width=250,
                           callback=self.__select_output_directory)
            dpg.add_same_line()
            dpg.add_button("Add file", width=250, callback=self.__select_file)
            dpg.add_spacing(count=10)
            dpg.add_separator()

            dpg.add_text("Selected output directory:")
            dpg.add_table('Files', ['Path', 'Name'],
                          height=200,
                          callback=self.__remove_file)
            dpg.add_separator()
            dpg.add_progress_bar('Zip Progress', width=-1)
            dpg.add_separator()
            dpg.add_button("Clear files",
                           width=250,
                           callback=self.__clear_files)
            dpg.add_same_line()
            dpg.add_button("Zip Files", width=250, callback=self.__zip_files)
            dpg.add_spacing()
            dpg.add_label_text('##warnings')

            # Render Callback and Start gui
            dpg.set_render_callback(self.__render)
            dpg.start_dearpygui(primary_window="Main Window")
Exemplo n.º 10
0
def startup():
    with simple.window("main"):
        for idx in range(_COUNT):
            core.add_simple_plot(f"plot-{idx}",
                                 height=_HEIGHT,
                                 label=' ',
                                 maxscale=100.,
                                 value=[50] * _COUNT)

        # replace this source of "data" with your own static or dynamic source.
        d = threading.Thread(name='daemon',
                             target=fakeItTillYouMakeIt,
                             daemon=True)
        d.start()

    core.start_dearpygui(primary_window="main")
Exemplo n.º 11
0
    def run(self, *_args, **kwargs):
        """
        Runs stand-alone timer window with render callback.
        Mostly for demo purposes
        :return: Full development window with most basic setup to run a timer
        """
        base = BaseGUI(development=True)
        base.initialize_base_screens()
        self.create_timer(**kwargs)

        # A simple render callback that sends the current time
        render_callback = lambda sender, data: self.render(
            sender, data, time_to_render=datetime.datetime.today())

        c.set_render_callback(render_callback)

        c.start_dearpygui()
Exemplo n.º 12
0
    def run_gui(self):
        with window("Auto Pots"):
            set_start_callback(self.read_default_preferences)
            set_main_window_title('Auto Pots')
            set_window_pos("Auto Pots", 0, 0)
            add_spacing(count=12)

            add_button('Pick Maple Window', callback=self.pick_maple_window)
            add_text('Currently doing nothing. Pick MapleStory window.')
            add_spacing(count=12)

            add_text('Take HP Pot When Reaching', color=[232, 163, 33])
            add_slider_int("% HP", default_value=45, max_value=99, width=int(SCREEN_WIDTH * 0.8),
                           callback=self.change_hp_percentage)
            with menu('Select HP button on keyboard'):
                add_menu_item("Insert", callback=self.change_hp_keyboard_button)
                add_menu_item("Delete", callback=self.change_hp_keyboard_button)
                add_menu_item("Home", callback=self.change_hp_keyboard_button)
                add_menu_item("End", callback=self.change_hp_keyboard_button)
                add_menu_item("PgUp", callback=self.change_hp_keyboard_button)
                add_menu_item("PgDn", callback=self.change_hp_keyboard_button)

            add_spacing(count=12)
            add_text('Take MP Pot When Reaching', color=[232, 163, 33])
            add_slider_int("% MP", default_value=30, max_value=99, width=int(SCREEN_WIDTH * 0.8),
                           callback=self.change_mp_percentage)
            with menu('Select MP button on keyboard'):
                add_menu_item("Insert##1", callback=self.change_mp_keyboard_button)
                add_menu_item("Delete##1", callback=self.change_mp_keyboard_button)
                add_menu_item("Home##1", callback=self.change_mp_keyboard_button)
                add_menu_item("End##1", callback=self.change_mp_keyboard_button)
                add_menu_item("PgUp##1", callback=self.change_mp_keyboard_button)
                add_menu_item("PgDn##1", callback=self.change_mp_keyboard_button)

            add_spacing(count=12)
            add_button('Save Preferences As Default', callback=self.save_preferences)
            with popup("Save Preferences As Default", 'Save Popup', modal=True, mousebutton=mvMouseButton_Left):
                add_text('Your preferences has been saved')
                add_button("OK!", callback=lambda x, y: close_popup(item="Save Popup"))

            add_spacing(count=12)
            add_text('Currently doing nothing on HP. Pick button.')
            add_text('Currently doing nothing on MP. Pick button.')

        self.read_default_preferences()
        start_dearpygui(primary_window='Auto Pots')
Exemplo n.º 13
0
def main():

    # env = gym.make('Trajectory-v0')
    # episodes = collect_data(env, num_episodes, steps_per_episode, RandomPolicy(env), render)

    # show_demo()

    def save_callback(sender, data):
        print("Save Clicked")

    with simple.window("Generate Dataset"):
        core.add_text("Hello world")
        core.add_button("Save", callback=save_callback)
        core.add_input_text("string")
        core.add_slider_float("float")

    core.start_dearpygui()
Exemplo n.º 14
0
class ButtonSubClass(Button):
    def on_clicked(self, sender: str, data: Any):
        print(
            'this is the callback from overriding on_clicked in Button class')


def cb_button_class_button(sender, data):
    print('this is the callback from callback= in Button class init')


with TabBar('tabbar'):
    with Tab('main tab'):
        add_text('buttons:')
        button_subclass = ButtonSubClass('subclass button').place()
        button_class_button = Button('button class button',
                                     callback=cb_button_class_button).place()
        radio_buttons = RadioButtons(
            'radio buttons',
            'value 1',
            'value 2',
            'value 3',
            callback=lambda *_: print(
                f'{radio_buttons.selected_value} has been selected!')).place()

        add_text('\n\ninputs:')
        text_input = TextInput('text input').place()
        int_input = IntInput('int input', count=4).place()
        float_input = FloatInput('float input', count=4).place()

start_dearpygui()
Exemplo n.º 15
0
 def run():
     core.start_dearpygui(primary_window="main_window")
Exemplo n.º 16
0
        dpg.log_debug("start")
        thread_floaty = threading.Thread(target=produce_frame, args=())
        thread_floaty.setDaemon(True)
        thread_floaty.start()
        print(id(thread_floaty))

    else:
        print(id(thread_floaty))
        running=False
        thread_floaty.join()
        dpg.log_debug("stop")
        thread_floaty = None
    with sdpg.window():
        dpg.add_drawing('drawing', width=1000, height=800)
        dpg.add_text("tooltipTest")


with sdpg.window("Main Window"):
    # dpg.set_main_window_size(1400, 800)
    dpg.set_main_window_title("Pixel selector")
    # dpg.add_
    dpg.add_button("camera##1", callback=camera_frame_control, tip="this will not a freeze the GUI")





dpg.show_logger()
do.show_demo ()
dpg.start_dearpygui()
Exemplo n.º 17
0
    core.add_same_line()
    core.add_button('Github', callback=open_url, width=100)
    core.add_same_line()
    core.add_button('Discord', callback=open_url, width=100)
    core.add_same_line()
    core.add_button('Help', callback=open_url, width=100)

    core.add_separator()

    for value in load_config():
        key = value.get('key')

        core.add_text(f'{key}', bullet=True)
        core.add_input_text(f'{key}-input',
                            default_value=value.get('value'),
                            width=205,
                            label='')
        core.add_same_line()
        core.add_button(key + '_listen',
                        label='Listen',
                        callback=listen,
                        width=100)
        core.add_same_line()
        core.add_button(key + '_default',
                        label='Default',
                        callback=default,
                        width=100)
        core.add_separator()

core.start_dearpygui(primary_window=WINDOW)
Exemplo n.º 18
0
settingsWindow = SettingsWindow()

core.set_main_window_title("NeuronApplication")
with simple.window('MainWindow'):
    core.add_menu_bar("MenuBar")
    with simple.menu("Motyw##demo"):
        core.add_menu_item("Ciemny", callback=lambda sender, data: core.set_theme("Dark"), check=True)
        core.add_menu_item("Jasny", callback=lambda sender, data: core.set_theme("Light"), check=True)
        core.add_menu_item("Klasyczny", callback=lambda sender, data: core.set_theme("Classic"), check=True)
        core.add_menu_item("Ciemny 2", callback=lambda sender, data: core.set_theme("Dark 2"), check=True)
        core.add_menu_item("Szary", callback=lambda sender, data: core.set_theme("Grey"), check=True)
        core.add_menu_item("Ciemno-Szary", callback=lambda sender, data: core.set_theme("Dark Grey"), check=True)
        core.add_menu_item("Wisniowy", callback=lambda sender, data: core.set_theme("Cherry"), check=True)
        core.add_menu_item("Purpurowy", callback=lambda sender, data: core.set_theme("Purple"), check=True)
        core.add_menu_item("Zloty", callback=lambda sender, data: core.set_theme("Gold"), check=True)
        core.add_menu_item("Czerwony", callback=lambda sender, data: core.set_theme("Red"), check=True)
    with simple.menu("Pozycja"):
        core.add_menu_item("Zresetuj wszystko", callback=lambda sender, data: settingsWindow.reset_all())
        pass
    with simple.menu("Ukryj"):
        core.add_menu_item("Okno ustawien", callback = lambda sender, data: settingsWindow.toggle_visibility())
        core.add_menu_item("Wizualizacja sieci", callback = lambda sender, data: settingsWindow.betterVisualizer.toggle_visibility())
        core.add_menu_item("Wczytaj plik", callback = lambda sender, data: settingsWindow.importWindow.toggle_visibility())
        core.add_menu_item("Odpowiedz sieci", callback = lambda sender, data: settingsWindow.outputVisualisationWindow.toggle_visibility())
        core.add_menu_item("Historia uczenia##temp2", callback = lambda sender, data: settingsWindow.historyGraphWindow.toggle_visibility())



core.start_dearpygui(primary_window="MainWindow")

Exemplo n.º 19
0
 def _show_ui_thread(self):
     core.start_dearpygui()
Exemplo n.º 20
0
    core.add_text("Iris Flower Classification")
    core.add_slider_float("Sepal Length",
                          default_value=4.30,
                          min_value=4.30,
                          max_value=7.90,
                          callback=GetData)
    core.add_slider_float("Sepal Width",
                          default_value=2.00,
                          min_value=2.00,
                          max_value=4.40,
                          callback=GetData)
    core.add_slider_float("Petal Length",
                          default_value=1.00,
                          min_value=1.00,
                          max_value=6.90,
                          callback=GetData)
    core.add_slider_float("Petal Width",
                          default_value=0.10,
                          min_value=0.10,
                          max_value=2.50,
                          callback=GetData)
    # Predict callback
    core.add_button("Predict", callback=predict_button)
    core.add_text('\n\n')
    core.add_text('Result: ')
    core.add_same_line()
    core.add_label_text("\n##res", source="rs")

# Start DearPyGUI
core.start_dearpygui()  #primary_window="Iris Flower Prediction")
Exemplo n.º 21
0
 def run_gui():
     core.start_dearpygui(primary_window="Main Window")
Exemplo n.º 22
0
class ExampleGenerate():
	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 __generate(self):
		for c in range(self.__column):
			x = c * self.__row
			for r in range(self.__row):
				name = f"{choice(_FIRST)} {choice(_SECOND)} {choice(_THIRD)}"
				core.set_value(str(x + r), name)

if __name__ == "__main__":
	ExampleGenerate()
	core.start_dearpygui(primary_window="main")
Exemplo n.º 23
0
 def start_gui(self):
     dpg.start_dearpygui(primary_window="Main")
Exemplo n.º 24
0
                        before='Login',
                        width=200)


with simple.window('Moon Overwatch Leveling Bot'):
    core.set_style_item_spacing(15, 15)
    core.set_style_frame_padding(5, 5)
    core.add_additional_font('Roboto-Regular.ttf', 14)

    core.add_image('logo', 'moon.png')
    core.add_separator()

    core.add_input_text('Account Email',
                        default_value='*****@*****.**',
                        width=200)

    core.add_input_text('Account Password',
                        default_value='weShouldBuffBrig!69',
                        width=200)

    core.add_checkbox('Multiple Accounts',
                      default_value=False,
                      callback=multiple_accounts)

    core.add_same_line()
    core.add_button('Login', callback=login, width=85)
    core.add_separator()

core.set_theme('Red')
core.start_dearpygui(primary_window='Moon Overwatch Leveling Bot')
Exemplo n.º 25
0
def start_build_dpg():
    with simple.window("FACEIT Elo Overlay",
                       on_close=lambda: delete_item("FACEIT Elo Overlay"),
                       no_title_bar=True,
                       no_resize=True):
        """
        Set window configurations
        """

        simple.set_window_pos("FACEIT Elo Overlay", 0, 0)
        core.set_main_window_title("FACEIT Elo Overlay")
        core.set_main_window_size(492, 830)
        core.set_style_frame_rounding(6.00)
        core.add_additional_font("resources/OpenSans-Bold.ttf", size=14.5)
        """
        Initial loads
        """
        db_create.create_database(DBNAME)
        COLOR_List = config_functions.get_color()
        """
        Set some Background and Font Colors
        also the frame rounding and the window size
        """
        core.set_theme_item(mvGuiCol_Text, COLOR_List[1][0], COLOR_List[1][1],
                            COLOR_List[1][2], COLOR_List[1][3])
        core.set_theme_item(mvGuiCol_WindowBg, COLOR_List[3][0],
                            COLOR_List[3][1], COLOR_List[3][2],
                            COLOR_List[3][3])
        core.set_theme_item(mvGuiCol_Border, COLOR_List[4][0],
                            COLOR_List[4][1], COLOR_List[4][2],
                            COLOR_List[4][3])
        core.set_style_frame_border_size(1.00)
        core.set_theme_item(mvGuiCol_Button, COLOR_List[0][0],
                            COLOR_List[0][1], COLOR_List[0][2],
                            COLOR_List[0][3])
        core.set_theme_item(mvGuiCol_ButtonHovered, COLOR_List[0][0],
                            COLOR_List[0][1], COLOR_List[0][2],
                            COLOR_List[0][3])
        core.set_theme_item(mvGuiCol_ButtonActive, COLOR_List[2][0],
                            COLOR_List[2][1], COLOR_List[2][2],
                            COLOR_List[2][3])
        core.set_theme_item(mvGuiCol_BorderShadow, COLOR_List[0][0],
                            COLOR_List[0][1], COLOR_List[0][2] - 50,
                            COLOR_List[0][3])

    with simple.window('##Overlay',
                       no_collapse=True,
                       no_resize=True,
                       no_move=True,
                       no_close=True,
                       x_pos=30,
                       y_pos=0,
                       width=445,
                       height=790,
                       no_title_bar=True):
        """
        Set a Header 
        """
        bool_list_faceit, bool_list_match, name, acEloGoal = startup()
        core.add_button("FACEIT Overlay Menu")
        core.set_item_style_var("FACEIT Overlay Menu",
                                mvGuiStyleVar_FramePadding, [5 * 27, 5 * 3])
        core.add_spacing(count=5)
        """
        Build up the FACEIT Stats configuration 
        """

        with simple.group("##GroupStats"):
            core.add_button("Default Configurations##STATS")
            core.set_item_style_var("Default Configurations##STATS",
                                    mvGuiStyleVar_FramePadding,
                                    [5 * 20, 5 * 3])
            core.add_spacing(count=5)
            core.add_text("##TextFaceitName",
                          default_value="FACEIT Name:",
                          color=(255, 255, 0, -1))
            core.add_input_text("##FaceitName",
                                hint="FACEIT Name Case sensitive",
                                default_value=name,
                                callback=changes_detected)
            core.add_spacing(count=2)
            core.add_text("##TextEloGoal", default_value="FACEIT Elo goal:")
            core.add_input_text("##EloGoal",
                                hint="Set your Elo goal, empty = disabled",
                                default_value=str(acEloGoal),
                                callback=changes_detected)
            core.add_spacing(count=5)
            """
            Faceit Stats header 
            """
            core.add_button("FACEIT Stats")
            core.set_item_style_var("FACEIT Stats", mvGuiStyleVar_FramePadding,
                                    [5 * 26, 5 * 3])
            core.add_spacing(count=2)
            """
            Checkbox group 
            """
            core.add_checkbox(
                "Disable All##stats",
                default_value=False,
                callback=lambda sender, data: disable_all(sender))
            core.add_same_line()
            core.add_checkbox("Enable All##stats",
                              default_value=False,
                              callback=lambda sender, data: enable_all(sender))
            core.add_spacing(count=3)
            """
            Checkbox group 
            """
            core.add_checkbox("Current Elo##stats",
                              default_value=bool_list_faceit[0],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Faceit Rank##stats",
                              default_value=bool_list_faceit[1],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Elo Gained today##stats",
                              default_value=bool_list_faceit[2],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Win Streak##stats",
                              default_value=bool_list_faceit[3],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Total Matches##stats",
                              default_value=bool_list_faceit[4],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Matches Won##stats",
                              default_value=bool_list_faceit[5],
                              callback=changes_detected)
            core.add_spacing(count=2)
            win_loss = config_functions.get_win_loss()
            print(win_loss)
            if win_loss[0][0] is None:
                win_loss = [(0, 0)]
            core.add_text("##TextWinLoss", default_value="Win/Loss Stats:")
            core.add_checkbox("Day##WinLoss",
                              default_value=int(win_loss[0][0]),
                              callback=lambda sender, data: win_los(sender))
            core.add_same_line()
            core.add_checkbox("Week##WinLoss",
                              default_value=int(win_loss[0][1]),
                              callback=lambda sender, data: win_los(sender))
            core.add_spacing(count=5)
            """
            Last Match header 
            """
            core.add_button("Last Match")
            core.set_item_style_var("Last Match", mvGuiStyleVar_FramePadding,
                                    [5 * 26.5, 5 * 3])
            core.add_spacing(count=2)
            """
            Checkbox group 
            """
            core.add_checkbox(
                "Disable All##match",
                default_value=False,
                callback=lambda sender, data: disable_all(sender))
            core.add_same_line()
            core.add_checkbox("Enable All##match",
                              default_value=False,
                              callback=lambda sender, data: enable_all(sender))
            core.add_spacing(count=3)
            """
            Checkbox group 
            """
            core.add_checkbox("Score##match",
                              default_value=bool_list_match[0],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Result (W/L)##match",
                              default_value=bool_list_match[1],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Map##match",
                              default_value=bool_list_match[2],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("K/D##match",
                              default_value=bool_list_match[3],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Elo Diff##match",
                              default_value=bool_list_match[4],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Kills##match",
                              default_value=bool_list_match[5],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Death##match",
                              default_value=bool_list_match[6],
                              callback=changes_detected)
            core.add_spacing(count=5)
            """
            Apply Configuration to the database Button 
            """
            core.add_button("Apply Configuration", callback=save_data)
        """
        Start the Overlay with the current configuration 
        """
        core.add_spacing(count=3)
        core.add_button("Start", callback=open_overlay)
        core.set_item_style_var("Start", mvGuiStyleVar_FramePadding,
                                [5 * 29.5, 5 * 3])

    with simple.window('##Config',
                       no_collapse=True,
                       no_resize=True,
                       no_move=True,
                       no_close=True,
                       x_pos=0,
                       y_pos=1,
                       width=20,
                       height=790,
                       no_title_bar=True):
        core.set_item_color("##Config",
                            mvGuiCol_Text,
                            color=(COLOR_List[1][0], COLOR_List[1][1],
                                   COLOR_List[1][2], COLOR_List[1][3]))
        core.set_item_color("##Config",
                            mvGuiCol_WindowBg,
                            color=(COLOR_List[3][0], COLOR_List[3][1],
                                   COLOR_List[3][2], COLOR_List[3][3] - 10))
        core.set_item_style_var("##Config",
                                mvGuiStyleVar_WindowRounding,
                                value=[6])
        core.set_item_color("##Config",
                            mvGuiCol_Border,
                            color=(COLOR_List[4][0], COLOR_List[4][1],
                                   COLOR_List[4][2], COLOR_List[4][3]))
        core.add_image_button("##ConfigPlus",
                              value="resources/cfg_wheel.png",
                              callback=animation_config_color,
                              frame_padding=1,
                              tip="Settings & Colors")
        core.add_same_line(xoffset=50)
        with simple.group("##Config_Colors", show=False):
            COLOR_List = config_functions.get_color()
            core.add_text(
                "You can type in the RBG Values or click on the right Color Button"
            )

            core.add_color_edit4(name="Header#Color",
                                 default_value=[
                                     COLOR_List[0][0], COLOR_List[0][1],
                                     COLOR_List[0][2], COLOR_List[0][3]
                                 ],
                                 label="Header")
            core.add_color_edit4(name="Text#Color",
                                 default_value=[
                                     COLOR_List[1][0], COLOR_List[1][1],
                                     COLOR_List[1][2], COLOR_List[1][3]
                                 ],
                                 label="Text")
            core.add_color_edit4(name="ButtonActive#Color",
                                 default_value=[
                                     COLOR_List[2][0], COLOR_List[2][1],
                                     COLOR_List[2][2], COLOR_List[2][3]
                                 ],
                                 label="Button Active")
            core.add_color_edit4(name="BG#Color",
                                 default_value=[
                                     COLOR_List[3][0], COLOR_List[3][1],
                                     COLOR_List[3][2], COLOR_List[3][3]
                                 ],
                                 label="Background")
            core.add_color_edit4(name="Outline#Color",
                                 default_value=[
                                     COLOR_List[4][0], COLOR_List[4][1],
                                     COLOR_List[4][2], COLOR_List[4][3]
                                 ],
                                 label="Outline")
            core.add_separator()
            core.add_button("Test Colors", callback=test_colors)
            core.add_same_line()
            core.add_button("Reset", callback=reset_colors)
            core.add_button("Save Colors", callback=save_colors)
            core.add_spacing(count=2)
            core.add_separator()
            core.add_separator()
            core.add_spacing(count=2)
            scale = config_functions.get_scale()
            core.set_global_font_scale(scale)
            core.add_text("Change The Global Font Size")
            core.add_drag_float(
                "Global Scale",
                default_value=scale,
                format="%0.2f",
                speed=0.01,
                callback=lambda sender, data: core.set_global_font_scale(
                    core.get_value("Global Scale")))

            core.add_button("Reset##1", callback=reset_scale)
            core.add_button("Save Size##1", callback=save_scale)
            core.add_spacing(count=2)
            core.add_separator()
            core.add_separator()
            core.add_spacing(count=2)
            refresh = config_functions.get_refresh()
            refreshSymbol = config_functions.get_refresh_sign()
            core.add_text(
                "Change The refresh time for the Overlay ( in seconds )")
            core.add_input_int("##RefreshTime",
                               default_value=refresh,
                               min_value=5,
                               step=0)
            core.add_button("Save refresh time##1", callback=save_refresh_time)
            if refreshSymbol in "True":
                refreshSymbol = True
            else:
                refreshSymbol = False
            core.add_spacing(count=2)
            core.add_text("Enable, Disable the refresh sign in the overlay")
            core.add_checkbox("Refresh Symbol##RefreshTime",
                              default_value=refreshSymbol,
                              callback=refresh_symbol)
            core.add_separator()
            core.add_separator()
            core.add_button("Close##Color", callback=animation_config_color)

        core.add_spacing(count=3)
        core.add_image_button("##ConfigWeb",
                              value="resources/web.png",
                              callback=animation_config_web,
                              frame_padding=1,
                              tip="Web")
        core.add_spacing(count=2)
        core.add_image_button("##ConfigQuestion",
                              value="resources/q.png",
                              callback=animation_config_help,
                              frame_padding=1,
                              tip="Help")
        core.add_same_line(xoffset=50)

        with simple.group("##Web", show=False):
            web = webFunctions.get_web()
            web_parameters = webHandler.get_web_parameters()
            print(web_parameters)
            bgimage = ""
            core.add_text("Browser Settings")
            core.add_checkbox("Open in Browser Only##Browser",
                              default_value=web[0],
                              callback=lambda sender, data: save_web())
            core.add_same_line()
            core.add_checkbox("Open in Browser and App##Browser",
                              default_value=web[1],
                              callback=lambda sender, data: save_web())
            core.add_spacing(count=2)
            core.add_text("Text Size (pixel)")
            core.add_input_int("##BrowserTextSize",
                               default_value=web_parameters[0][0],
                               min_value=5,
                               step=0,
                               callback=save_font)
            core.add_text("Text Font:")
            core.add_combo("Font Family##Web",
                           items=WEB_FONT,
                           default_value=web_parameters[0][1],
                           callback=save_font)
            core.add_spacing(count=2)
            core.add_text(name="Background Image##Web",
                          default_value="Background Image")
            core.add_input_text("##BgImage",
                                default_value=web_parameters[0][2],
                                readonly=True)
            core.add_button("Search Background Image##Web",
                            callback=openFileDialog.get_background_image,
                            callback_data=bgimage)
            core.add_same_line()
            core.add_button(
                "Delete Background Image##Web",
                callback=lambda sender, data: core.set_value("##BgImage", ""))
            core.add_separator()
            core.add_separator()
            core.add_button("Close##Web", callback=animation_config_web)

        with simple.group("##Help", show=False):
            core.add_text("OUTDATED, WILL BE UPDATED IN THE NEXT RELEASE")
            core.add_input_text(
                "##HelpIntroText",
                multiline=True,
                readonly=True,
                height=110,
                width=340,
                default_value="Welcome to the help page of the Faceit Overlay\n"
                "here the options and different possibilities are\n"
                "explained to you.\n"
                "Here is a small overview;\n"
                "1: Start menu\n"
                "2: Color configuration\n"
                "3: Overlay")
            core.add_spacing(count=2)
            core.add_text("1: Start menu")
            core.add_image("##StartmenuImage",
                           value="resources/start_menu.png")
            core.add_input_text(
                "##HelpStartMenuText",
                multiline=True,
                height=70,
                width=340,
                readonly=True,
                default_value="The start menu is the configuration menu\n"
                "Here you can change colors, global size\n"
                "Enable / disable stats you want to see\n"
                "and start the Overlay")
            core.add_spacing(count=2)
            core.add_text("2: Color configuration")
            core.add_image("##ColorconfImage",
                           value="resources/color_config.png")
            core.add_input_text(
                "##HelpColorConfigText",
                multiline=True,
                height=220,
                width=340,
                readonly=True,
                default_value=
                "Here you can adjust the colors according to your own taste.\n"
                "The buttons have the following functions:\n\n"
                "Test Color: Sets the color for the menu so that you can check it.\n"
                "Reset Color: Sets the colors back to the default value.\n"
                "Save Color: Saves the colors so that they will be kept\n"
                "\t\t\t\t\t   on the next startup.\n\n"
                "To adjust the global size of the texts and heads you can move \n"
                "the slider to the left or right and then use the buttons \n"
                "to perform the following functions:\n\n"
                "Reset: Set the size back to 1.0\n"
                "Save Size: Save the global size for the next start up")
            core.add_spacing(count=2)
            core.add_text("3: Overlay")
            core.add_image("##OverlayImage", value="resources/overlay.png")
            core.add_input_text(
                "##HelpOverlayText",
                multiline=True,
                height=100,
                width=340,
                readonly=True,
                default_value=
                "The overlay has basically no functionalities except \n"
                "that it updates itself regularly (every 60 seconds) \n"
                "and thus adjusts the values.\n"
                "But if you click on the headers \n"
                "FACEIT STATS | LAST GAME  you get back to the start screen.\n"
            )
            core.add_button("Close##Help", callback=animation_config_help)
    """ ---------------------------------------------------------------------------------------------------------------
                                                START DPG 
        -------------------------------------------------------------------------------------------------------------"""
    core.enable_docking(dock_space=False)
    core.start_dearpygui(primary_window="FACEIT Elo Overlay")
Exemplo n.º 26
0
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)
Exemplo n.º 27
0
from serial import Serial
from dearpygui import core, simple
ser = Serial('com6')
t = True

with simple.window("Current Temp"):
    core.add_label_text("temp", "Hello world", color=[255, 255, 255])

core.start_dearpygui()

while t:
    read = str(ser.readline())
    l = len(read)
    end = l - 5
    subread = read[2:end]
    core.set_value("temp", subread)



Exemplo n.º 28
0
        core.add_button("Choose template file",
                        callback=open_template_file,
                        width=200)
        core.add_same_line(spacing=10)
        core.add_input_text(
            "template_file",
            label="",
            width=300,
            enabled=False,
        )
        core.add_button("Choose output folder",
                        callback=open_output_folder,
                        width=200)
        core.add_same_line(spacing=10)
        core.add_input_text(
            "output_folder",
            label="",
            width=300,
            enabled=False,
        )
        core.add_same_line(spacing=10)
        core.add_input_text("Output file", width=100, default_value="out.docx")
        core.add_button("Start creation", callback=start_creation)

    Base.metadata.create_all(engine)
    core.add_additional_font("OpenSans-Regular.ttf", 25)
    core.set_theme("Light")
    core.set_main_window_title("Create Document from Template")
    core.set_main_window_pos(0, 0)
    core.start_dearpygui(primary_window="Create Document from Template")
    def Init(self) -> None:

        self._create_primary_window()
        self.ShowHelloWindow()
        core.start_dearpygui(primary_window=self._primary_window_name)
Exemplo n.º 30
0
    def start(self):
        available_out_ports = mido.get_output_names()
        available_in_ports = mido.get_input_names()

        if len(available_in_ports) > 0:
            status.current_in_port = mido.open_input(
                available_in_ports[0], callback=self.get_midi_input)

        if len(available_out_ports) > 0:
            self.out_port = mido.open_output(available_out_ports[0])

        core.set_main_window_size(350, 550)
        core.set_main_window_title('Fractal Melody Machine')
        core.set_theme('Gold')

        with simple.window('Fractal Melody Machine', width=500, height=300):
            core.add_text('MIDI Input Port')
            core.add_combo('ComboInPort', items=mido.get_input_names(
            ), default_value=status.current_in_port.name, label='', width=100, callback=self.change_midi_in_port)

            core.add_text('MIDI Output Port')
            core.add_combo('ComboOutPort', items=mido.get_output_names(
            ), default_value=self.out_port.name, label='', width=100, callback=self.change_midi_out_port)

            core.add_spacing(count=10)

            core.add_text('BPM')
            core.add_slider_int('SliderBPM', default_value=60, min_value=20, max_value=200, label='', width=100, callback=self.change_bpm)

            core.add_text('Depth')
            core.add_slider_int('SliderDepth', default_value=4, min_value=1,
                                max_value=16, label='', width=100, callback=self.change_depth)

            core.add_same_line(spacing=45)
            core.add_text('DetectedKey', default_value='Detected Key: ')

            core.add_text('Branching Factor')
            core.add_slider_int('SliderBF', default_value=2, min_value=2,
                                max_value=4, label='', width=100, callback=self.change_bf)

            core.add_text('Octave Spread')
            core.add_child('OctaveWindow', width=300, height=150)
            core.end()

            core.add_text('Figures')
            core.add_child('FigureWindow', width=300, height=150)

            core.add_table('FigureTable', [], hide_headers=True, height=10)

            core.add_columns('FigureTableCols', 2, border=False)

            core.add_checkbox(str(theory.FIGURE_WHOLE_NOTE), label='Whole note', callback=self.change_figures)
            core.add_checkbox(str(theory.FIGURE_QUARTER_NOTE), label='Quarter note', callback=self.change_figures, default_value=True)
            core.add_checkbox(str(theory.FIGURE_16TH_NOTE), label='16th note', callback=self.change_figures)
            core.add_checkbox(str(theory.FIGURE_64TH_NOTE), label='64th note', callback=self.change_figures)

            core.add_next_column()

            core.add_checkbox(str(theory.FIGURE_HALF_NOTE), label='Half note', callback=self.change_figures)
            core.add_checkbox(str(theory.FIGURE_8TH_NOTE), label='8th note', callback=self.change_figures, default_value=True)
            core.add_checkbox(str(theory.FIGURE_32ND_NOTE), label='32nd note', callback=self.change_figures)

            core.end()

            # Initialize octave spread sliders
            self.change_depth()

        core.start_dearpygui(primary_window='Fractal Melody Machine')