Exemple #1
0
    def set_rows(self, nrows):
        """ "Set the rows in the table

        Each row has two columns. The first column is the grid number. The second column is a list
        of applications to snap to the grid. We use a table to enable multiselect
        """
        dpg_core.log_info(f"Refreshing rows for table {self.id}")
        for row in range(1, nrows + 1):
            name = f"{self._id}_{row}"
            # If the row already exists, we don't need to do anything else
            if dpg_core.does_item_exist(name):
                continue

            with dpg_simple.managed_columns(name,
                                            len(self.HEADER),
                                            parent=self.parent):
                # The first column is the grid number
                dpg_core.add_input_int(
                    f"##{self._id}_{row}_number",
                    default_value=row,
                    readonly=True,
                    step=0,
                    parent=name,
                )

                # The second column is the table. Wrap in a collapsing header so the screen isn't
                # too full the entire time.
                with dpg_simple.collapsing_header(f"##{self._id}_{row}_header",
                                                  parent=name):
                    dpg_core.add_table(
                        f"{self._id}_{row}_table",
                        [""],  # no headers
                        callback=self.selected,
                        parent=f"##{self._id}_{row}_header",
                    )
                    # populate the table with the names of available windows
                    for window_name in sorted(self.ACTIVE_WINDOWS):
                        dpg_core.add_row(f"{self._id}_{row}_table",
                                         [window_name])

            # Separate each row with a line
            dpg_core.add_separator(name=f"{self._id}_{row}_sep", parent=name)

        self._nrows = nrows
        dpg_core.log_info(f"Refreshed rows for table {self.id}")
def create_new_user_gui():
    with window("Main"):
        gg.add_input_text(
            name="##user_name",
            hint="User name",
            tip="Your username",
            parent="Main"
            )
        gg.add_input_int(
            name="##balance_input",
            default_value=500,
            tip="Your starting balance",
            parent="Main"
            )

        def create_new_user_data(sender, data) -> None:
            initial_data = {
            "User Name": gg.get_value("##user_name"),
            "Start Balance": gg.get_value("##balance_input")
            }

            if not initial_data["User Name"].isalpha():
                gg.add_label_text("Error", color=[255, 0, 0],
                                  before="##balance_input", label="Username must be alphabetical")
                gg.log_error("User-name must be only alphabets")
                return
            elif initial_data["User Name"] + ".db" in os.listdir():
                gg.add_label_text("Error", color=[255, 0, 0],
                                  before="##balance_input",label="Username already exists!")
                gg.log_error("User-name must be unique")
                return

            if initial_data["Start Balance"] <= 0:
                gg.add_label_text("Error_start_balance",
                                  color=[255, 0, 0], before="Proceed",label="Balance must be greater than 0$")
                gg.log_error("Balance must be greater than 0$!")
                return
            
            create_database(initial_data["User Name"] + ".db", initial_data["Start Balance"])
            gg.delete_item("Main")
            initial_screen()
        
        gg.add_button("Proceed", callback=create_new_user_data)
Exemple #3
0
def start():
    """
    Renders main window elements.
    """
    with open('token.txt', 'r') as token_file:
        token = token_file.readline()
        try:
            # Connect to IBM
            core.run_async_function(get_backends_async, data=token)
            core.set_render_callback(show_button)

            # Progress bar
            with simple.window('Please wait',
                               no_scrollbar=True,
                               height=70,
                               width=400,
                               x_pos=500,
                               y_pos=200):
                core.add_progress_bar('progress',
                                      value=0.0,
                                      overlay='Connecting to IBM...',
                                      width=400)
                core.run_async_function(progress_async, 0)

            # Menu bar
            with simple.menu_bar("Main Menu Bar"):

                with simple.menu("File"):

                    core.add_menu_item("Save", callback=print_me)
                    core.add_menu_item("Save As", callback=print_me)

                core.add_menu_item("Help", callback=open_help_window)
                core.add_menu_item("About", callback=open_about_window)

            # Parameters group
            with simple.group('left group', width=350):
                # Select file button
                core.add_child('##file_block',
                               width=350,
                               height=180,
                               show=False)
                core.add_button('File Selector', callback=file_picker)
                core.add_spacing(name='##space2', count=3)
                core.add_text('File location:')
                core.add_label_text('##filedir',
                                    value='None Selected',
                                    source='directory')
                core.add_spacing(name='##space3', count=3)
                core.add_text('File name:')
                core.add_label_text('##file',
                                    value='None Selected',
                                    source='file_directory')
                core.end()
                core.add_spacing(name='##space4', count=3)
                # Architecture type radio button
                core.add_child('##settings_block',
                               width=350,
                               height=450,
                               show=False)
                core.add_text('Architecture type:')
                core.add_radio_button('radio##1',
                                      items=[
                                          'IBM simulator',
                                          'IBM quantum computer',
                                          'Arbitrary computer coupling'
                                      ],
                                      callback=show_architecture_list,
                                      source='device_type')
                core.add_spacing(name='##space5', count=3)
                # "Create arbitrary coupling" button
                core.add_button('Create custom architecture',
                                callback=create_architecture,
                                show=False)
                core.add_spacing(name='##space11', count=3)
                # Layout radio button
                core.add_text('Quantum circuit layout method:')
                core.add_radio_button(
                    'radio##2',
                    items=['Original IBM layout', 'Advanced SWAP placement'],
                    source='layout_type')
                core.add_spacing(name='##space6', count=3)
                # Optimization level slider
                core.add_text('Optimization level:')
                core.add_slider_int(
                    '##optimization_lvl',
                    default_value=1,
                    min_value=0,
                    max_value=3,
                    tip='drag the slider to select an optimization level',
                    width=300,
                    source='opt_level')
                core.add_spacing(name='##space7', count=3)
                # Number of iterations slider
                core.add_text('Number of iterations:')
                core.add_input_int('##num_of_iter',
                                   width=300,
                                   callback=check_iteration_num,
                                   default_value=100)
                core.add_spacing(name='##space8', count=3)
                # Default settings button
                core.add_button('Set Default', callback=set_default)
                core.end()
                core.add_spacing(name='##space9', count=3)
                # Process button
                core.add_button('Process', callback=process, show=False)

            # graph images
            core.add_same_line(name='line##3', xoffset=370)
            with simple.group('center group'):
                core.add_child('##images_block', width=640, show=False)
                # Input circuit preview
                core.add_text('Input circuit:')
                core.add_drawing('input_circuit', width=600, height=500)
                core.draw_rectangle('input_circuit', [0, 150], [600, 500],
                                    [255, 255, 255, 0], [255, 255, 255, 50])
                # Output circuit view
                core.add_text('Output circuit:')
                core.add_drawing('output_circuit', width=600, height=500)
                core.draw_rectangle('output_circuit', [0, 150], [600, 500],
                                    [255, 255, 255, 0], [255, 255, 255, 50])
                core.end()

            # program output
            core.add_same_line(name='line##3', xoffset=1020)
            with simple.group('right group'):
                core.add_child('##output_block1',
                               width=460,
                               height=300,
                               show=False)
                core.add_button('Open qasm file', callback=open_qasm)
                core.add_text('Path to IBM circuit representation')
                core.add_label_text('##circuitImage')
                core.add_button('Mapping', callback=show_mapping)
                core.end()
                core.add_text('Program output:', show=False)
                core.add_child('##output_block2',
                               width=460,
                               height=180,
                               show=False)
                core.add_text('Program output will be displayed here',
                              wrap=440)
                core.end()

        except Exception as exc:
            print("[ERROR]: {}".format(exc))
Exemple #4
0
    def __init__(self):
        self.tensorFlowInterface = TensorFlowInterface()
        self.outputVisualisationWindow = OutputVisualisationWindow()
        self.historyGraphWindow = HistoryGraphWindow()

        with simple.window(self.windowName,
                           width=self.xSize,
                           height=self.ySize,
                           x_pos=self.xPos,
                           y_pos=self.yPos):
            core.add_text(self.simulationSetting)
            core.add_button(self.createNetwork,
                            callback=self.create_network_callback)
            core.add_same_line()
            core.add_button(self.createVisualization,
                            callback=self.create_visualisation_callback)
            core.add_same_line()
            core.add_button(self.createOutputPrediction,
                            callback=self.create_output_prediction)
            core.add_same_line()
            core.add_button(self.historyGraph,
                            callback=self.create_history_graph)
            core.add_button(self.trainData,
                            callback=self.execute_training_data)
            core.add_same_line()
            #core.add_slider_int(self.timeToTrain, default_value = 100, min_value=1, max_value=1000, width = 200)
            core.add_input_int(self.timeToTrain,
                               default_value=100,
                               min_value=1,
                               max_value=1000,
                               width=200)
            core.add_same_line()
            core.add_checkbox(self.use2DInOut)

            core.add_slider_int(self.numberOfLayers,
                                default_value=2,
                                min_value=2,
                                max_value=self.maxNumberOfLayers,
                                callback=self.layer_slider_callback,
                                width=200)
            for i in range(0, self.maxNumberOfLayers):
                core.add_slider_int(self.layer + str(i),
                                    default_value=1,
                                    width=200)
                core.add_same_line()
                core.add_combo(self.type + '##' + str(i),
                               items=self.neuronTypeList,
                               width=70,
                               callback=self.change_list_callback,
                               default_value='Dense')
                core.add_same_line()
                core.add_combo(self.activation + '##' + str(i),
                               items=self.neuronActivationList,
                               width=70,
                               callback=self.change_list_callback,
                               default_value='relu')

            core.add_separator()
            self.layer_slider_callback()

        #self.visualization_window = VisualizationWindow()
        self.betterVisualizer = BetterVisualizer()
        self.betterVisualizer.hide_window()
        self.importWindow = ImportWindow()
        self.neuronDataContainer = ModelDataContainer(
            self.neuronDataContainerDefaultData[0],
            self.neuronDataContainerDefaultData[1],
            self.neuronDataContainerDefaultData[2],
            self.neuronDataContainerDefaultData[3])
        self.modify_neuron_list()
        self.tensorFlowInterface.create_model(self.neuronDataContainer)
        super().__init__()
Exemple #5
0
def show_demo():

    with cxt.collapsing_header(label="Drawlists"):

        with cxt.group():

            dpg.add_radio_button(
                ("Layer 1", "Layer 2", "Layer 3"),
                default_value="Layer 1",
                callback=lambda sender: _set_layer(dpg.get_value(sender)))
            dpg.add_listbox(("Line", "Circle"),
                            label="Draw Item",
                            default_value="Line",
                            width=100,
                            callback=_switch_group)

            with cxt.group(width=200) as g:
                global line_group
                line_group = g
                p1_input = dpg.add_input_intx(label="p1",
                                              size=2,
                                              default_value=(10, 10))
                p2_input = dpg.add_input_intx(label="p2",
                                              size=2,
                                              default_value=(100, 100))
                thickness_input = dpg.add_input_int(label="thickness",
                                                    default_value=1)
                color_input = dpg.add_color_picker(label="color",
                                                   default_value=(255, 255,
                                                                  255, 255))
                dpg.add_button(label="Add",
                               callback=lambda: dpg.draw_line(
                                   dpg.get_value(p1_input),
                                   dpg.get_value(p2_input),
                                   thickness=dpg.get_value(thickness_input),
                                   color=dpg.get_value(color_input),
                                   parent=current_layer))

            with cxt.group(show=False, width=200) as g:
                global circle_group
                circle_group = g
                center_input = dpg.add_input_intx(label="center",
                                                  size=2,
                                                  default_value=(100, 100))
                radius_input = dpg.add_input_int(label="radius",
                                                 default_value=20)
                thickness_input = dpg.add_input_int(label="thickness",
                                                    default_value=1)
                seg_input = dpg.add_input_int(label="segments",
                                              default_value=0)
                color_input = dpg.add_color_picker(label="color",
                                                   default_value=(255, 255,
                                                                  255, 255))
                fill_input = dpg.add_color_picker(label="fill",
                                                  default_value=(0, 0, 0, 0),
                                                  alpha_bar=True)
                dpg.add_button(label="Add",
                               callback=lambda: dpg.draw_circle(
                                   dpg.get_value(center_input),
                                   dpg.get_value(radius_input),
                                   thickness=dpg.get_value(thickness_input),
                                   segments=dpg.get_value(seg_input),
                                   color=dpg.get_value(color_input),
                                   fill=dpg.get_value(fill_input),
                                   parent=current_layer))

        dpg.add_same_line()

        with cxt.drawlist(id="drawlist_demo", width=800, height=500):
            global current_layer, layer_1, layer_2, layer_3
            dpg.draw_rectangle((0, 0), (800, 500),
                               color=(100, 100, 100, 250),
                               thickness=2)
            layer_1 = dpg.add_draw_layer()
            layer_2 = dpg.add_draw_layer()
            layer_3 = dpg.add_draw_layer()
            current_layer = layer_1
Exemple #6
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")
Exemple #7
0
def show_demo():

    with cxt.collapsing_header(label="Widgets"):

        with cxt.tree_node(label="Basic"):

            with cxt.group(horizontal=True):
                dpg.add_button(label="Button", callback=_log)
                dpg.add_button(label="Button", callback=_log, small=True)
                dpg.add_button(label="Button", callback=_log,
                               arrow=True)  # default direction is mvDir_Up
                dpg.add_button(label="Button",
                               callback=_log,
                               arrow=True,
                               direction=dpg.mvDir_Left)
                dpg.add_button(label="Button",
                               callback=_log,
                               arrow=True,
                               direction=dpg.mvDir_Right)
                dpg.add_button(label="Button",
                               callback=_log,
                               arrow=True,
                               direction=dpg.mvDir_Down)

            dpg.add_checkbox(label="checkbox", callback=_log)
            dpg.add_radio_button(("radio a", "radio b", "radio c"),
                                 callback=_log,
                                 horizontal=True)
            dpg.add_selectable(label="selectable", callback=_log)

            with cxt.group(horizontal=True) as g:

                for i in range(0, 7):
                    button = dpg.add_button(label="Click", callback=_log)
                    dpg.set_theme_style(dpg.mvThemeStyle_Button_Rounding,
                                        i * 5,
                                        item=button)
                    dpg.set_theme_style(dpg.mvThemeStyle_Button_PaddingX,
                                        i * 3,
                                        item=button)
                    dpg.set_theme_style(dpg.mvThemeStyle_Button_PaddingY,
                                        i * 3,
                                        item=button)
                    dpg.set_theme_color(dpg.mvThemeCol_Button_Bg,
                                        _hsv_to_rgb(i / 7.0, 0.6, 0.6),
                                        item=button)
                    dpg.set_theme_color(dpg.mvThemeCol_Button_Active,
                                        _hsv_to_rgb(i / 7.0, 0.8, 0.8),
                                        item=button)
                    dpg.set_theme_color(dpg.mvThemeCol_Button_Hovered,
                                        _hsv_to_rgb(i / 7.0, 0.7, 0.7),
                                        item=button)

            with cxt.group(horizontal=True):

                dpg.add_text("Press a button: ")
                dpg.add_button(arrow=True,
                               direction=dpg.mvDir_Left,
                               callback=lambda: dpg.set_value(
                                   widget,
                                   int(dpg.get_value(widget)) - 1))
                dpg.add_button(arrow=True,
                               direction=dpg.mvDir_Right,
                               callback=lambda: dpg.set_value(
                                   widget,
                                   int(dpg.get_value(widget)) + 1))
                widget = dpg.add_text("0")

            widget2 = dpg.add_text("hover me")
            with cxt.tooltip(
                    parent=widget2
            ):  # note that "parent" is the item the tooltip show's for
                dpg.add_text("I'm a fancy tooltip")

            dpg.add_separator()

            dpg.add_text("Value", label="Label", show_label=True)
            dpg.add_combo(("AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF",
                           "GGGG", "HHHH", "IIII", "JJJJ", "KKKK"),
                          label="combo",
                          default_value="AAAA",
                          callback=_log)
            dpg.add_input_text(label="input text",
                               default_value="Hello, world!",
                               callback=_log)
            _help("USER:\n"
                  "Hold SHIFT or use mouse to select text.\n"
                  "CTRL+Left/Right to word jump.\n"
                  "CTRL+A or double-click to select all.\n"
                  "CTRL+X,CTRL+C,CTRL+V clipboard.\n"
                  "CTRL+Z,CTRL+Y undo/redo.\n"
                  "ESCAPE to revert.\n\n")
            dpg.add_input_text(label="input text (w/ hint)",
                               hint="enter text here",
                               callback=_log)
            dpg.add_input_int(label="input int", callback=_log)
            dpg.add_input_float(label="input float", callback=_log)
            dpg.add_input_float(label="input scientific",
                                format="%e",
                                callback=_log)
            dpg.add_input_floatx(label="input floatx",
                                 callback=_log,
                                 default_value=[1, 2, 3, 4])
            dpg.add_drag_int(label="drag int", callback=_log)
            _help("Click and drag to edit value.\n"
                  "Hold SHIFT/ALT for faster/slower edit.\n"
                  "Double-click or CTRL+click to input value.")
            dpg.add_drag_int(label="drag int 0..100",
                             format="%d%%",
                             callback=_log)
            dpg.add_drag_float(label="drag float", callback=_log)
            dpg.add_drag_float(label="drag small float",
                               default_value=0.0067,
                               format="%.06f ns",
                               callback=_log)
            dpg.add_slider_int(label="slider int", max_value=3, callback=_log)
            _help("CTRL+click to enter value.")
            dpg.add_slider_float(label="slider float",
                                 max_value=1.0,
                                 format="ratio = %.3f",
                                 callback=_log)
            dpg.add_slider_int(label="slider angle",
                               min_value=-360,
                               max_value=360,
                               format="%d deg",
                               callback=_log)
            _help("Click on the colored square to open a color picker.\n"
                  "Click and hold to use drag and drop.\n"
                  "Right-click on the colored square to show options.\n"
                  "CTRL+click on individual component to input value.\n")
            dpg.add_color_edit((102, 179, 0, 128),
                               label="color edit 4",
                               callback=_log,
                               uint8=True)
            dpg.add_color_edit(default_value=(.5, 1, .25, .1),
                               label="color edit 3",
                               callback=_log,
                               m_3component=True,
                               uint8=True,
                               floats=False)
            dpg.add_listbox(
                ("Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange",
                 "Pineapple", "Strawberry", "Watermelon"),
                label="listbox",
                num_items=4,
                callback=_log)
            dpg.add_color_button(label="color button")

        with cxt.tree_node(label="Bullets"):

            dpg.add_text("Bullet point 1", bullet=True)
            dpg.add_text(
                "Bullet point 2\nbullet text can be\nOn multiple lines",
                bullet=True)

            with cxt.tree_node(label="Tree node"):
                dpg.add_text("Another bullet point", bullet=True)

            dpg.add_text("1", bullet=True)
            dpg.add_same_line()
            dpg.add_button(label="Button", small=True)

        with cxt.tree_node(label="Text"):

            with cxt.tree_node(label="Colored Text"):

                dpg.add_text("Pink", color=(255, 0, 255))
                dpg.add_text("Yellow", color=(255, 255, 0))

            with cxt.tree_node(label="Word Wrapping"):

                dpg.add_text(
                    'This text should automatically wrap on the edge of the window.The current implementation for the text wrapping follows simple rules suited for English and possibly other languages',
                    wrap=0)
                dpg.add_slider_int(
                    label="wrap width",
                    default_value=500,
                    max_value=1000,
                    callback=lambda sender: dpg.configure_item(
                        "_demo_wrap", wrap=dpg.get_value(sender)))
                dpg.add_text(
                    'The lazy dong is a good dog. This paragraph should fit within the child. Testing a 1 character word. The quick brown fox jumps over the lazy dog.',
                    id="_demo_wrap",
                    wrap=100)

        with cxt.tree_node(label="Text Input"):

            dpg.add_checkbox(label="readonly",
                             callback=_config,
                             callback_data="Multi-line Text Input")
            dpg.add_checkbox(label="on_enter",
                             callback=_config,
                             callback_data="Multi-line Text Input")

            with cxt.tree_node(id="Multi-line Text Input"):

                dpg.add_input_text(
                    multiline=True,
                    default_value="/*\n"
                    " The Pentium F00F bug, shorthand for F0 0F C7 C8,\n"
                    " the hexadecimal encoding of one offending instruction,\n"
                    " more formally, the invalid operand with locked CMPXCHG8B\n"
                    " instruction bug, is a design flaw in the majority of\n"
                    " Intel Pentium, Pentium MMX, and Pentium OverDrive\n"
                    " processors (all in the P5 microarchitecture).\n"
                    "*/\n\n"
                    "label:\n"
                    "\tlock cmpxchg8b eax\n",
                    height=300,
                    callback=_log,
                    tab_input=True)

            with cxt.tree_node(label="Filtered Text Input"):

                dpg.add_input_text(callback=_log, label="default")
                dpg.add_input_text(callback=_log,
                                   label="decimal",
                                   decimal=True)
                dpg.add_input_text(callback=_log,
                                   label="no blank",
                                   no_spaces=True)
                dpg.add_input_text(callback=_log,
                                   label="uppercase",
                                   uppercase=True)
                dpg.add_input_text(callback=_log,
                                   label="scientific",
                                   scientific=True)
                dpg.add_input_text(callback=_log,
                                   label="hexdecimal",
                                   hexadecimal=True)

            with cxt.tree_node(label="Password Input"):

                password = dpg.add_input_text(label="password",
                                              password=True,
                                              callback=_log)
                dpg.add_input_text(label="password (w/ hint)",
                                   password=True,
                                   hint="<password>",
                                   source=password,
                                   callback=_log)
                dpg.add_input_text(label="password (clear)",
                                   source=password,
                                   callback=_log)

        with cxt.tree_node(label="Simple Plots"):

            dpg.add_simple_plot(
                label="Frame Times",
                default_value=[0.6, 0.1, 1.0, 0.5, 0.92, 0.1, 0.2])
            dpg.add_simple_plot(label="Histogram",
                                default_value=(0.6, 0.1, 1.0, 0.5, 0.92, 0.1,
                                               0.2),
                                height=80,
                                histogram=True,
                                minscale=0.0)

            data1 = []
            for i in range(0, 70):
                data1.append(cos(3.14 * 6 * i / 180))

            dpg.add_simple_plot(label="Lines", default_value=data1, height=80)
            dpg.add_simple_plot(label="Histogram",
                                default_value=data1,
                                height=80,
                                histogram=True)
            dpg.add_progress_bar(label="Progress Bar",
                                 default_value=0.78,
                                 overlay="78%")
            dpg.add_same_line()
            dpg.add_text("Progress Bar")
            bar = dpg.add_progress_bar(default_value=0.78, overlay="1367/1753")
            dpg.set_theme_color(dpg.mvThemeCol_ProgressBar_Bar,
                                (255, 0, 0, 255),
                                item=bar)

        with cxt.tree_node(label="Multi-component Widgets"):

            for i in range(2, 5):

                with cxt.group():
                    float_source = dpg.add_input_floatx(
                        label=f"input float {i}",
                        min_value=0.0,
                        max_value=100.0,
                        size=i)
                    dpg.add_drag_floatx(label=f"drag float {i}",
                                        source=float_source,
                                        size=i)
                    dpg.add_slider_floatx(label=f"slider float {i}",
                                          source=float_source,
                                          size=i)

                with cxt.group():

                    int_source = dpg.add_input_intx(label=f"input int {i}",
                                                    min_value=0,
                                                    max_value=100,
                                                    size=i)
                    dpg.add_drag_intx(label=f"drag int {i}",
                                      source=int_source,
                                      size=i)
                    dpg.add_slider_intx(label=f"slider int {i}",
                                        source=int_source,
                                        size=i)

                dpg.add_dummy(height=10)

        with cxt.tree_node(label="Vertical Sliders"):

            dpg.add_slider_int(label=" ",
                               default_value=1,
                               vertical=True,
                               max_value=5,
                               height=160)
            dpg.add_same_line()

            with cxt.group(horizontal=True):

                values = [0.0, 0.60, 0.35, 0.9, 0.70, 0.20, 0.0]

                for i in range(0, 7):
                    widget3 = dpg.add_slider_float(label=" ",
                                                   default_value=values[i],
                                                   vertical=True,
                                                   max_value=1.0,
                                                   height=160)
                    dpg.set_theme_color(dpg.mvThemeCol_SliderFloat_Bg,
                                        _hsv_to_rgb(i / 7.0, 0.5, 0.5),
                                        item=widget3)
                    dpg.set_theme_color(dpg.mvThemeCol_SliderFloat_Grab,
                                        _hsv_to_rgb(i / 7.0, 0.9, 0.9),
                                        item=widget3)
                    dpg.set_theme_color(dpg.mvThemeCol_SliderFloat_BgActive,
                                        _hsv_to_rgb(i / 7.0, 0.7, 0.5),
                                        item=widget3)
                    dpg.set_theme_color(dpg.mvThemeCol_SliderFloat_BgHovered,
                                        _hsv_to_rgb(i / 7.0, 0.6, 0.5),
                                        item=widget3)

            dpg.add_same_line()
            with cxt.group():
                for i in range(0, 3):
                    with cxt.group(horizontal=True):
                        values = [0.20, 0.80, 0.40, 0.25]
                        for j in range(0, 4):
                            dpg.add_slider_float(label=" ",
                                                 default_value=values[j],
                                                 vertical=True,
                                                 max_value=1.0,
                                                 height=50)

            dpg.add_same_line()
            with cxt.group(horizontal=True):
                dpg.add_slider_float(label=" ",
                                     vertical=True,
                                     max_value=1.0,
                                     height=160,
                                     width=40)
                dpg.add_slider_float(label=" ",
                                     vertical=True,
                                     max_value=1.0,
                                     height=160,
                                     width=40)
                dpg.add_slider_float(label=" ",
                                     vertical=True,
                                     max_value=1.0,
                                     height=160,
                                     width=40)
                dpg.add_slider_float(label=" ",
                                     vertical=True,
                                     max_value=1.0,
                                     height=160,
                                     width=40)

        with cxt.tree_node(label="Time/Date Widgets"):

            dpg.add_time_picker(label="Time Picker",
                                default_value={
                                    'hour': 14,
                                    'min': 32,
                                    'sec': 23
                                })
            dpg.add_separator()

            with cxt.table(header_row=False):

                dpg.add_table_column()
                dpg.add_table_column()
                dpg.add_table_column()

                dpg.add_date_picker(label="Date Picker1",
                                    level=0,
                                    default_value={
                                        'month_day': 8,
                                        'year': 93,
                                        'month': 5
                                    })
                dpg.add_table_next_column()
                dpg.add_date_picker(label="Date Picker2",
                                    level=1,
                                    default_value={
                                        'month_day': 8,
                                        'year': 93,
                                        'month': 5
                                    })
                dpg.add_table_next_column()
                dpg.add_date_picker(label="Date Picker3",
                                    level=2,
                                    default_value={
                                        'month_day': 8,
                                        'year': 93,
                                        'month': 5
                                    })

        with cxt.tree_node(label="Loading Indicators"):

            dpg.add_loading_indicator()
            dpg.add_same_line()
            dpg.add_loading_indicator(style=1)

        with cxt.tree_node(label="Knobs"):

            with cxt.group(horizontal=True):

                dpg.add_knob_float(label="K1")
                dpg.add_knob_float(label="K2", default_value=25.0)
                dpg.add_knob_float(label="K3", default_value=50.0)

        with cxt.tree_node(label="2D/3D Sliders"):

            dpg.add_3d_slider(label="3D Slider", scale=0.5)
Exemple #8
0
 def _setup_add_widget(self, dpg_args) -> None:
     dpgcore.add_input_int(self.id, **dpg_args)
Exemple #9
0
    def build(self):
        with simple.window("game_win", autosize=True):
            with simple.group("player"):
                left_label_text("Round: ",
                                "round",
                                default_value=str(self.round))
                left_label_text("Player: ",
                                "player",
                                default_value=self.player.name)
                left_label_text("Cash: ",
                                "cash",
                                default_value=str(self.player.cash))
                core.add_spacing(count=5)
                core.add_button("next_round",
                                label="Next round",
                                callback=self.next_round)

            core.add_spacing(count=5)
            core.add_separator()
            core.add_spacing(count=5)

            with simple.group("stocks"):
                # Titles
                core.add_text("Company")
                core.add_same_line(xoffset=stock_table_offsets[1])
                core.add_text("Price")
                core.add_same_line(xoffset=stock_table_offsets[2])
                core.add_text("Owned")
                core.add_same_line(xoffset=stock_table_offsets[3])
                core.add_text("Change")
                core.add_same_line(xoffset=stock_table_offsets[4])
                core.add_text("Old price")
                core.add_same_line(xoffset=stock_table_offsets[5])
                core.add_text("New price")
                core.add_same_line(xoffset=stock_table_offsets[6])
                core.add_text("Dividend")

                for stock in self.stocks:
                    core.add_text(stock.name)
                    core.add_same_line(xoffset=stock_table_offsets[1])
                    core.add_text(f"stock.{stock.name}.price",
                                  default_value=str(stock.price))
                    core.add_same_line(xoffset=stock_table_offsets[2])

                    # Buy / Sell functionality
                    core.add_input_int(
                        f"stock.{stock.name}.owned",
                        label="",
                        default_value=self.player.get_owned_stocks(stock),
                        max_value=int(self.player.cash / stock.price),
                        min_clamped=True,
                        max_clamped=True,
                        callback=self.buy_or_sell,
                        callback_data=[
                            stock,
                        ],
                        width=100,
                    )

                    core.add_same_line(xoffset=stock_table_offsets[3])
                    core.add_text(f"stock.{stock.name}.change",
                                  default_value=str(stock.change))
                    core.add_same_line(xoffset=stock_table_offsets[4])
                    core.add_text(
                        f"stock.{stock.name}.previous_price",
                        default_value=str(stock.previous_price),
                    )
                    core.add_same_line(xoffset=stock_table_offsets[5])
                    core.add_text(f"stock.{stock.name}.price2",
                                  default_value=str(stock.price))
                    core.add_same_line(xoffset=stock_table_offsets[6])
                    core.add_text(
                        f"stock.{stock.name}.dividend",
                        default_value=str(stock.dividend),
                    )

        core.set_main_window_title("Stock Trader")
        core.set_main_window_size(650, 450)
        core.set_main_window_resizable(False)
Exemple #10
0
            with cxt.menu(label="Settings"):

                dpg.add_menu_item(label="Option 1", callback=_log)
                dpg.add_menu_item(label="Option 2", check=True, callback=_log)
                dpg.add_menu_item(label="Option 3",
                                  check=True,
                                  default_value=True,
                                  callback=_log)

                with cxt.child(height=60, autosize_x=True):
                    for i in range(0, 10):
                        dpg.add_text(f"Scolling Text{i}")

                dpg.add_slider_float(label="Slider Float")
                dpg.add_input_int(label="Input Int")
                dpg.add_combo(("Yes", "No", "Maybe"), label="Combo")

        with cxt.menu(label="Tools"):

            dpg.add_menu_item(label="Show About",
                              callback=lambda: dpg.show_tool("mvAboutWindow"))
            dpg.add_menu_item(
                label="Show Metrics",
                callback=lambda: dpg.show_tool("mvMetricsWindow"))
            dpg.add_menu_item(label="Show Documentation",
                              callback=lambda: dpg.show_tool("mvDocWindow"))
            dpg.add_menu_item(label="Show Debug",
                              callback=lambda: dpg.show_tool("mvDebugWindow"))
            dpg.add_menu_item(label="Show Style Editor",
                              callback=lambda: dpg.show_tool("mvStyleWindow"))
Exemple #11
0
    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()
Exemple #12
0
            dpg.add_menu_item(label="Save")
            dpg.add_menu_item(label="Save As...")

            with cxt.menu(label="Settings"):

                dpg.add_menu_item(label="Option 1", callback=_log)
                dpg.add_menu_item(label="Option 2", check=True, callback=_log)
                dpg.add_menu_item(label="Option 3", check=True, default_value=True, callback=_log)

                with cxt.child(height=60, autosize_x=True):
                    for i in range(0, 10):
                        dpg.add_text(f"Scolling Text{i}")

                dpg.add_slider_float(label="Slider Float")
                dpg.add_input_int(label="Input Int")
                dpg.add_combo(("Yes", "No", "Maybe"), label="Combo")

        with cxt.menu(label="Tools"):

            dpg.add_menu_item(label="Show About", callback=lambda:dpg.show_tool("mvAboutWindow"))
            dpg.add_menu_item(label="Show Metrics", callback=lambda:dpg.show_tool("mvMetricsWindow"))
            dpg.add_menu_item(label="Show Documentation", callback=lambda:dpg.show_tool("mvDocWindow"))
            dpg.add_menu_item(label="Show Debug", callback=lambda:dpg.show_tool("mvDebugWindow"))
            dpg.add_menu_item(label="Show Style Editor", callback=lambda:dpg.show_tool("mvStyleWindow"))
            dpg.add_menu_item(label="Show Font Manager", callback=lambda:dpg.show_tool("mvFontManager"))
            dpg.add_menu_item(label="Show Item Registry", callback=lambda:dpg.show_tool("mvItemRegistry"))

    dpg.add_text(default_value=f'Dear PyGui says hello. ({dpg.get_dearpygui_version()})')
    dpg.add_text(default_value="This code for this demo can be found here: ")
    dpg.add_text(default_value="https://github.com/hoffstadt/DearPyGui/blob/master/DearPyGui/dearpygui/demo.py")