Exemplo n.º 1
0
    def __init__(self, title=__title__):
        super(WStarting, self).__init__(title)
        self.seconds = 24
        self.paused = False
        self.layout = [[
            sg.Frame(title="Additional options:",
                     layout=[[
                         sg.Button(button_text="Watch Live",
                                   key="watch_live",
                                   size=(10, 1),
                                   font=("wingdings", 14)),
                         sg.Button(button_text="Load File",
                                   key="load_file",
                                   size=(10, 1),
                                   font=("wingdings", 14)),
                     ]],
                     size=(25, 3),
                     relief=sg.RELIEF_SUNKEN)
        ],
                       [
                           sg.Button(button_text="Start Component",
                                     key="start_component",
                                     size=(16, 1),
                                     font=("wingdings", 14))
                       ],
                       [
                           sg.Text("The component will start automatically",
                                   auto_size_text=True,
                                   justification="left")
                       ],
                       [
                           sg.ProgressBar(max_value=self.seconds,
                                          key="countdown",
                                          orientation="h",
                                          size=(20, 20))
                       ],
                       [
                           sg.Button(button_text="Exit",
                                     key="Exit",
                                     size=(10, 1),
                                     font=("verdana", 14)),
                       ]]

        self.window = None
        self.progress_bar = None
Exemplo n.º 2
0
def CustomMeter():
    # layout the form
    layout = [[sg.Text('A custom progress meter')],
              [
                  sg.ProgressBar(10000,
                                 orientation='h',
                                 size=(20, 20),
                                 key='progress')
              ], [sg.Cancel()]]

    # create the form`
    window = sg.Window('Custom Progress Meter').Layout(layout)
    progress_bar = window.FindElement('progress')
    # loop that would normally do something useful
    for i in range(10000):
        # check to see if the cancel button was clicked and exit loop if clicked
        button, values = window.ReadNonBlocking()
        if button == 'Cancel' or values == None:
            break
        # update bar with loop value +1 so that bar eventually reaches the maximum
        progress_bar.UpdateBar(i + 1)
    # done with loop... need to destroy the window as it's still open
    window.CloseNonBlocking()
Exemplo n.º 3
0
The GUI is used to show progress bars during the training process and 
to collect user input that is sent to the chatbot.  The reply is displayed in the GUI window
'''

# Create the 'Trainer GUI'
# The Trainer GUI consists of a lot of progress bars stacked on top of each other
sg.ChangeLookAndFeel('GreenTan')
sg.DebugWin()
MAX_PROG_BARS = 20  # number of training sessions
bars = []
texts = []
training_layout = [
    [sg.T('TRAINING PROGRESS', size=(20, 1), font=('Helvetica', 17))],
]
for i in range(MAX_PROG_BARS):
    bars.append(sg.ProgressBar(100, size=(30, 4)))
    texts.append(sg.T(' ' * 20, size=(20, 1), justification='right'))
    training_layout += [
        [texts[i], bars[i]],
    ]  # add a single row

training_window = sg.Window('Training').Layout(training_layout)
current_bar = 0


# callback function for training runs
def print_progress_bar(description,
                       iteration_counter,
                       total_items,
                       progress_bar_length=20):
    global current_bar