Esempio n. 1
0
from tkinter import Tk, Label, Entry, Button, StringVar
from tkinter import messagebox

kalkulator = Tk()
kalkulator.title('Kalkulator')

L1 = Label(kalkulator, text='angka 1')
L1.grid(row=0, column=0)
angka1 = StringVar()
E1 = Entry(kalkulator, textvariable=angka1)
E1.grid(row=0, column=1, columnspan=3)

L2 = Label(kalkulator, text='angka 2')
L2.grid(row=1, column=0)
angka2 = StringVar()
E2 = Entry(kalkulator, textvariable=angka2)
E2.grid(row=1, column=1, columnspan=3)


def tambah():
    a = float(angka1.get())
    b = float(angka2.get())
    hasil = a + b
    L.config(text=hasil)


B1 = Button(kalkulator, text='+', command=tambah)
B1.grid(row=2, column=0)


def kurang():
Esempio n. 2
0
def makeModel(window):
    ProblemSelect = page(window, 'Problem Type')
    ProblemSelect.pack()

    problemType = StringVar(value="Text (Classification) -- Default")
    continueVar = BooleanVar()

    explanationBox = Label(ProblemSelect.contentFrame)

    problemTypeChoices = {
        'Numbers (Regression)':
        'Numerical data with continuous numerical output e.g. stock market data',
        'Numbers (Classification)':
        'Numerical data with fixed outputs e.g even and odd numbers',
        'Text (Regression)':
        'Text data with continuous numerical output e.g sentiment analysis',
        'Text (Classification) -- Default':
        'Text data with fixed outputs e.g spam filtering. Default option'
    }

    for choice, description in problemTypeChoices.items():
        option = Radiobutton(ProblemSelect.contentFrame,
                             text=choice,
                             variable=problemType,
                             value=choice,
                             command=lambda description=description:
                             explanationBox.config(text=description))
        option.grid(column=0, sticky='w', padx=5, pady=5)
    map(lambda x: x.deselect(),
        list(ProblemSelect.contentFrame.children.values()))
    list(ProblemSelect.contentFrame.children.values())[-1].invoke()

    explanationBox.grid(column=1, row=3, sticky='e')
    nxtBtn = Button(ProblemSelect.contentFrame,
                    text="next",
                    command=lambda: continueVar.set(True))
    nxtBtn.grid(column=1, columnspan=2, padx=10, ipadx=30, ipady=5)

    ProblemSelect.wait_variable(continueVar)
    ProblemSelect.pack_forget()

    # select which columns to use
    DataCollecting = page(window, 'Select Training Data')
    DataCollecting.pack()

    # load data
    fileNotLoaded = True
    counter = 0
    while fileNotLoaded:
        if counter == 10:
            messagebox.showerror(title='Error', message=retryError)
            sys.exit()
        try:
            counter += 1
            filename = askopenfilename(title='Choose Training Data',
                                       filetypes=dataFiletypes)
            if path.splitext(filename)[1].lower() == '.csv':
                trainingDataDF = read_csv(filename)
            else:
                trainingDataDF = read_excel(filename)
            # If you didn't clean your data, I'm just going to destroy it. Serves you right.
            trainingDataDF = trainingDataDF.apply(
                lambda x: x.interpolate(method='pad'))
            trainingDataDF = trainingDataDF.dropna(how='any')
            if len(trainingDataDF.index) < 50:
                raise ValueError(
                    ': Not enough data. Have to have at least 50 samples of data.\n'
                    'If you think you have enough, it might be because there were'
                    'invalid values that were automatically taken out.')
        except Exception as e:
            messagebox.showerror(title='Error',
                                 message=str(type(e)).split('\'')[1] + str(e))
            continue
        fileNotLoaded = False

    # listbox with all the column names
    columnListbox = ScrollingListbox(DataCollecting.contentFrame, 20)
    columnListbox.grid(column=0,
                       row=0,
                       rowspan=8,
                       padx=10,
                       pady=10,
                       sticky='ns')
    for columName in trainingDataDF.columns:
        columnListbox.listbox.insert('end', columName)

    featureListbox = ScrollingListbox(DataCollecting.contentFrame)
    featureListbox.grid(column=2, row=0, rowspan=4, padx=10, pady=10)

    featureAddButton = Button(
        DataCollecting.contentFrame,
        text='Add >>>',
        command=lambda: addToListBox(columnListbox, featureListbox))
    featureAddButton.grid(column=1, row=1)

    featureRemoveButton = Button(
        DataCollecting.contentFrame,
        text='<<< Remove',
        command=lambda: deleteFromListBox(featureListbox))
    featureRemoveButton.grid(column=1, row=2)

    targetListbox = ScrollingListbox(DataCollecting.contentFrame)
    targetListbox.grid(column=2, row=4, rowspan=4, padx=10, pady=10)

    targetAddButton = Button(
        DataCollecting.contentFrame,
        text='Add >>>',
        command=lambda: addToListBox(columnListbox, targetListbox))
    targetAddButton.grid(column=1, row=5)

    targetRemoveButton = Button(
        DataCollecting.contentFrame,
        text='<<< Remove',
        command=lambda: deleteFromListBox(targetListbox))
    targetRemoveButton.grid(column=1, row=6)

    collectDataButton = Button(
        DataCollecting.contentFrame,
        text='Create',
        command=lambda: continueVar.set(True)
        if len(featureListbox.listbox.get(0, 'end')) > 0 and len(
            targetListbox.listbox.get(0, 'end')
        ) > 0 else messagebox.showwarning(
            title='Warning',
            message='You must have at least one feature and one target'))
    collectDataButton.grid(column=2, row=8, pady=20, ipadx=20)

    DataCollecting.wait_variable(continueVar)
    DataCollecting.pack_forget()

    creating = page(window, 'Creating')
    creating.pack()

    progress = Progressbar(creating.contentFrame)
    progress.pack()
    progress.config(mode='indeterminate')
    progress.start()

    sleep(2)

    featureColumnNames = featureListbox.listbox.get(0, 'end')
    targetColumnNames = targetListbox.listbox.get(0, 'end')

    featureTrain = trainingDataDF[list(featureColumnNames)]
    targetTrain = trainingDataDF[list(targetColumnNames)]

    featureEncoder = LabelEncoder()
    targetEncoder = LabelEncoder()

    if 'Text' in problemType.get():
        featureEncoder.fit(
            array(list(
                set(featureTrain.to_numpy().flatten().tolist()))).reshape(
                    -1, 1).ravel())
        featureTrain = featureTrain.applymap(
            lambda x: featureEncoder.transform(array(x).reshape(1, 1))[0])

    if 'Classification' in problemType.get():
        targetEncoder.fit(
            array(list(
                set(targetTrain.to_numpy().flatten().tolist()))).reshape(
                    -1, 1).ravel())
        targetTrain = targetTrain.applymap(
            lambda x: targetEncoder.transform(array(x).reshape(1, 1))[0])

    model = chooseAlgorithm(problemType.get(), featureTrain, targetTrain)

    progress.stop()
    progress.pack_forget()

    modelname = str(model.__class__).split('.')[-1][:-2]
    filename = modelname + ' ' + datetime.now().strftime("%Y-%m-%d-%H-%M-%S")

    fileNotLoaded = True
    counter = 0
    while fileNotLoaded:
        if counter == 10:
            messagebox.showerror(title='Error', message=retryError)
            sys.exit()
        try:
            counter += 1
            filepath = asksaveasfilename(
                initialfile=filename,
                defaultextension='.mlmc',
                filetypes=[('Edward Machine Learning Creater Model', '*.emlcm')
                           ],
                title='Save As')
            dump([
                model,
                problemType.get(), featureEncoder, targetEncoder,
                featureTrain.columns, targetTrain.columns
            ], filepath, 5)
        except Exception as e:
            messagebox.showerror(title='Error',
                                 message=str(type(e)).split('\'')[1] + str(e))
            continue
        fileNotLoaded = False

    backButton = Button(
        creating.contentFrame,
        text='Back to Home Page',
        font=('Helvetica', 30),
        command=lambda:
        [continueVar.set(True),
         creating.destroy(),
         HomePage(window)])
    backButton.pack(pady=20)

    quitButton = Button(
        creating.contentFrame,
        text='Quit',
        font=('Helvetica', 30),
        command=lambda: [continueVar.set(True),
                         window.destroy()])
    quitButton.pack(pady=20)

    creating.wait_variable(continueVar)
Esempio n. 3
0
    def __init__(self):

        self.__ventana = Tk()
        self.__ventana.resizable(0, 0)
        self.__ventana.title('Cotizacion del Dolar')

        #mainframe = ttk.Frame(self.__ventana, padding="5 5 12 5")
        #mainframe.grid(column=0, row=0, sticky= (N,W,E,S))
        #mainframe.columnconfigure(0, weight=1)
        #mainframe.rowconfigure(0, weight=1)
        #mainframe['borderwidth'] = 2
        #mainframe['relief'] = 'sunken'
        #self.separ1 = ttk.Separator(mainframe, orient=HORIZONTAL)

        self.__nombre = StringVar()
        self.__compra = StringVar()
        self.__venta = StringVar()
        self.__actualizacion = StringVar()

        fuente = font.Font(size=10, weight='bold')

        ttk.Label(self.__ventana, text='Moneda',font=fuente). \
            grid(column=1, row=1, sticky=W)
        ttk.Label(self.__ventana, text='Compra',font=fuente). \
            grid(column=2, row=1, sticky=W)
        ttk.Label(self.__ventana, text='Venta',font=fuente). \
            grid(column=3, row=1, sticky=W)

        f = datetime.datetime.now()
        date = '%s/%s/%s %s:%s:%s' % (f.day, f.month, f.year, f.hour, f.minute,
                                      f.second)
        self.__actualizacion.set(date)

        complete_url = 'https://www.dolarsi.com/api/api.php?type=valoresprincipales'
        r = requests.get(complete_url)
        x = r.json()
        cant = len(x)
        fila = 2
        for i in range(cant):
            columna = 1
            nombre = str(x[i]['casa']['nombre'])
            if nombre.find('Dolar') >= 0:
                self.__nombre = nombre
                if (x[i]['casa']['compra'] !=
                        'No Cotiza') or (x[i]['casa']['venta'] != '0'):
                    self.__compra = str(x[i]['casa']['compra'])
                    self.__venta = str(x[i]['casa']['venta'])
                    self.nombre =ttk.Label(self.__ventana, text=self.__nombre). \
                        grid(column=columna, row=fila, sticky=(W, E))
                    columna += 1
                    self.compra =ttk.Label(self.__ventana, text=self.__compra). \
                        grid(column=columna, row=fila, sticky=(W, E))
                    columna += 1
                    self.venta =ttk.Label(self.__ventana, text=self.__venta). \
                        grid(column=columna, row=fila, sticky=(W, E))
                    fila += 1

        ttk.Label(self.__ventana, text='Ultima actualizacion:'). \
            grid(column=1, row=8, sticky=W)
        ttk.Label(self.__ventana, textvariable=self.__actualizacion). \
            grid(column=2, row=8, sticky=(W, E))
        ttk.Button(self.__ventana, text='Actualizar', command=self.actualizar).\
            grid(column=2, row=9, sticky=(W,E))

        for child in self.__ventana.winfo_children():
            child.grid_configure(padx=5, pady=5)
        self.__ventana.mainloop()
Esempio n. 4
0
    def __init__(self, parent, val):
        top = self.top = Toplevel(parent)
        top.resizable(False, False)

        windowWidth = top.winfo_reqwidth()
        windowHeight = top.winfo_reqheight()

        positionRight = int(top.winfo_screenwidth()/2.6 - windowWidth/2)
        positionDown = int(top.winfo_screenheight()/2.5 - windowHeight/2)

        top.geometry("+{}+{}".format(positionRight, positionDown))

        self.formula = ''
        self.reactiveFormula = StringVar(value=val)
        self.label = Label(top, text='Enter your formula below')
        self.label.grid(row=0, columnspan=8)
        self.entryBox = Entry(top, width=30, textvariable = self.reactiveFormula, font=large_font)
        self.entryBox.grid(row=1, columnspan=8, pady=3)
        Button0 = Button(
            top,
            width=20,
            text="pow(a, b)",
            command = lambda:self.btnPress('pow(a,b)'))
        Button0.grid(row = 2, column = 0)
        Button1 = Button(
            top,
            width=20,
            text="sqrt(a)",
            command = lambda:self.btnPress('sqrt(a)'))
        Button1.grid(row = 2, column = 1)
        Button2 = Button(
            top,
            width=20,
            text="OR",
            command = lambda:self.btnPress('OR'))
        Button2.grid(row = 2, column = 2)
        Button3 = Button(
            top,
            width=20,
            text="AND",
            command = lambda:self.btnPress('AND'))
        Button3.grid(row = 3, column = 0)
        Button4 = Button(
            top,
            width=20,
            text="XOR",
            command = lambda:self.btnPress('XOR'))
        Button4.grid(row = 3, column = 1)
        Button8 = Button(
            top,
            width=20,
            text="+",
            command = lambda:self.btnPress('+'))
        Button8.grid(row = 3, column = 2)
        Button9 = Button(
            top,
            width=20,
            text="-",
            command = lambda:self.btnPress('-'))
        Button9.grid(row = 4, column = 0)
        Button10 = Button(
            top,
            width=20,
            text="*",
            command = lambda:self.btnPress('*'))
        Button10.grid(row = 4, column = 1)
        Button11 = Button(
            top,
            width=20,
            text="/",
            command = lambda:self.btnPress('/'))
        Button11.grid(row = 4, column = 2)

        self.mySubmitButton = Button(top, width=30, text='Submit', command=self.send)
        self.mySubmitButton.grid(row = 5, columnspan=8, pady=10)
Esempio n. 5
0
def chooseDataType():
    def storeDataType():
        current_selection = var.get()
        if current_selection != "None":
            label.config(text="Currently selected: " + current_selection)

            dataTypeEntry['text'] = current_selection
            parameters["Data Type"] = current_selection
            dataTypeButton['bg'] = "green"
            messagebox.showinfo(title="Selection Successful",
                                message="Data Type saved.")
            checkReadyToCompress()
            top.destroy()
        else:
            dataTypeEntry['text'] = ""
            parameters["Data Type"] = ""
            dataTypeButton['bg'] = "red"
            checkReadyToCompress()
            messagebox.showerror(
                title="Invalid Selection",
                message=
                "Please select a valid value. Valid values are:\nStreamData, 90minute, 9hour, 24hour, 90hour, 120hour, Monolith"
            )

    top = Toplevel()
    top.iconbitmap("sce_icon.ico")
    top.resizable(0, 0)
    top.geometry("400x200")
    top.title("Choose type/resolution of data:")
    var = StringVar()
    var.set("None")
    option1 = Radiobutton(top,
                          text="StreamData (SCEP_...)",
                          variable=var,
                          value="StreamData",
                          command=storeDataType)
    option1.pack(anchor="w")
    option2 = Radiobutton(top,
                          text="90minute (SCEC_...)",
                          variable=var,
                          value="90minute",
                          command=storeDataType)
    option2.pack(anchor="w")
    option3 = Radiobutton(top,
                          text="9hour (SCED_...)",
                          variable=var,
                          value="9hour",
                          command=storeDataType)
    option3.pack(anchor="w")
    option4 = Radiobutton(top,
                          text="24hour (SCEK_...)",
                          variable=var,
                          value="24hour",
                          command=storeDataType)
    option4.pack(anchor="w")
    option5 = Radiobutton(top,
                          text="90hour (SCEM_...)",
                          variable=var,
                          value="90hour",
                          command=storeDataType)
    option5.pack(anchor="w")
    option6 = Radiobutton(top,
                          text="120hour (SCEW_...)",
                          variable=var,
                          value="120hour",
                          command=storeDataType)
    option6.pack(anchor="w")
    option7 = Radiobutton(top,
                          text="Monolith (SCET_...)",
                          variable=var,
                          value="Monolith",
                          command=storeDataType)
    option7.pack(anchor="w")
    option8 = Radiobutton(top,
                          text="Please Select One from Above",
                          variable=var,
                          value="None",
                          command=storeDataType)
    option8.pack(anchor="w")

    label = Label(top)
    label.pack()
    top.mainloop()
Esempio n. 6
0
from tkinter import Tk, Entry, Button, Label, StringVar, messagebox as mbox, END


def clear():
    name_entry.delete(0, END)
    surname_entry.delete(0, END)


def display_full_name():
    mbox.showinfo('GUI Python', name.get() + ' ' + surname.get())


root = Tk()
root.title('GUI на Python')

name = StringVar()
surname = StringVar()

name_label = Label(text='Введите имя:')
surname_label = Label(text='Введите фамилию:')

name_label.grid(row=0, column=0, sticky='w')
surname_label.grid(row=1, column=0, sticky='w')

name_entry = Entry(textvariable=name)
surname_entry = Entry(textvariable=surname)

name_entry.insert(0, 'Tom')
surname_entry.insert(0, 'Soyer')

name_entry.grid(row=0, column=1, padx=5, pady=5)
Esempio n. 7
0
    messagebox.showinfo('提示', showinfo)


inputText = scrolledtext.ScrolledText(frmLeft, bd=0, width=50, bg=None)
inputText.pack(side='left', fill='y', expand='no')

message = Button(frmSelectPath,
                 bd=1,
                 bg=None,
                 text='支持哪些??',
                 command=showinfoEvent)
message.pack(side='left', fill=None, expand='no')

selectPathLabel = Label(frmSelectPath, text="保存路径文件夹:")
selectPathLabel.pack(side="left")
downloadPath = StringVar(top, value='download')
inputSelectPath = Entry(frmSelectPath,
                        bd=0,
                        textvariable=downloadPath,
                        state='readonly')
inputSelectPath.pack(side="left", fill="x", expand='yes')


def selectPath():
    path_ = askdirectory()
    if path_ and os.path.exists(path_):
        downloadPath.set(path_.replace('/', sep).replace('\\', sep))
        writeConfig()


def openPath():
Esempio n. 8
0
    def __init__(self,
                 master,
                 options=[],
                 selected=None,
                 command=None,
                 grid=None,
                 align=None,
                 visible=True,
                 enabled=None,
                 width=None,
                 height=None):
        """
        Creates a Combo

        :param Container master:
            The Container (App, Box, etc) the Combo will belong too.

        :param List option:
            A list of strings to populate the Combo, defaults to an empty list.

        :param string selected:
            The item in the Combo to select, defaults to `None`.

        :param callback command:
            The callback function to call when the Combo changes,
            defaults to `None`.

        :param List grid:
            Grid co-ordinates for the widget, required if the master layout
            is 'grid', defaults to `None`.

        :param string align:
            How to align the widget within the grid, defaults to None.

        :param bool visible:
            If the widget should be visible, defaults to `True`.

        :param bool enabled:
            If the widget should be enabled, defaults to `None`. If `None`
            the value is inherited from the master.

        :param int width:
            The starting width of the widget. Defaults to `None` and will auto
            size.

        :param int height:
            The starting height of the widget. Defaults to `None` and will auto
            size.
        """

        # Maintain a list of options (as strings, to avoid problems comparing)
        self._options = [str(x) for x in options]

        description = "[Combo] object with options  " + str(self._options)

        # Store currently selected item
        self._selected = StringVar()

        # Create a tk OptionMenu object within this object
        if len(self._options) == 0:
            tk = OptionMenu(master.tk,
                            self._selected,
                            None,
                            command=self._command_callback)
        else:
            tk = OptionMenu(master.tk,
                            self._selected,
                            *self._options,
                            command=self._command_callback)

        # Create the combo menu object
        self._combo_menu = ComboMenu(tk["menu"])

        super(Combo, self).__init__(master, tk, description, grid, align,
                                    visible, enabled, width, height)

        # Remove the thick highlight when the bg is a different color
        self._set_tk_config("highlightthickness", 0)

        # Set the selected item
        if selected is None:
            # set the first option
            self._set_option_by_index(0)
        else:
            self._set_option(selected)

        self._default = selected

        # The command associated with this combo
        self.update_command(command)
Esempio n. 9
0
    def __init__(self):  #Fonction d'initialisation du programme

        Thread.__init__(self)  #Lance la classe dans un thread
        """Edition de nom de variable associé aux autres fichiers du programme"""
        try:
            self.vid = oneCameraCapture.cameraCapture(
            )  #test si la caméra est basler
            self.basler = True
        except:
            try:
                self.cam = OpenCam.openCamera()  #Pour toutes les autres camera
                self.basler = False
            except:
                print("Need camera troubleshooting")  #Surement pas de caméra
                exit()

        self.trmt = Img_Traitement.Traitement(
        )  #Lance l'initalisation de la classe traitement
        self.output_path = Path.cwd()  #Chemin de sortie de la photo
        """"Edition de l'interface"""
        self.window = tk.Tk()  #Réalisation de la fenêtre principale
        self.window.state('zoomed')  #Lance le GUI en plein écran

        self.window.title("Beam analyzer Python")
        self.window.config(background="#FFFFFF")  #Couleur de la fenêtre
        self.window.protocol(
            'WM_DELETE_WINDOW',
            self.destructor)  #La croix de la fenetre va fermer le programme
        """"definition des proportions pour les frames"""
        self.window.grid_columnconfigure(1, weight=3)
        self.window.grid_columnconfigure(2, weight=2)
        self.window.grid_rowconfigure(1, weight=3)
        self.window.grid_rowconfigure(2, weight=3)
        """Definition de certaines variables nécessaires au demarrage de l'interface"""
        #Variables pour la taille des pixels des caméras
        self.size_pixel_height = DoubleVar()
        self.size_pixel_width = DoubleVar()

        #Variables d'affichage des figures
        self.choix_fig_XY = IntVar()
        self.choix_fig_XY = 0

        #Variables du barycentre de l'image
        self.cX = IntVar()
        self.cY = IntVar()

        #Variables du fit ellipse
        self.ellipse_width = IntVar()
        self.ellipse_height = IntVar()
        self.ellipse_angle = IntVar()

        #Variables du fit gauss
        self.titre_gauss1 = StringVar()
        self.titre_gauss2 = StringVar()
        self.gauss_amp1 = StringVar()
        self.gauss_mean1 = StringVar()
        self.gauss_stddev1 = StringVar()
        self.gauss_amp2 = StringVar()
        self.gauss_mean2 = StringVar()
        self.gauss_stddev2 = StringVar()

        #Valeurs d'initialisation des tailles de l'affichage
        self.Screen_x = 1500
        self.Screen_y = 1000
        self.Screen2_x = 750
        self.Screen2_y = 750

        #Temps en ms entre chaque actualisation de l'interface
        self.delay = 15

        #Variable de l'écran de l'image traité
        self.frame2 = []

        #Variable pour l'aligenement des faisceaux
        self.align = False
        self.choix_fig = 0

        #Appel de toutes les fonctions permettant l'affichage de notre programme
        self.display()
        #self.plot()
        self.Interface()  #Lance la fonction Interface
        self.flux_cam()

        #detection du nombre de pixels par pouce: utile pour l'affichage des plots
        self.dpi = self.cadre_plots.winfo_fpixels('1i')
        self.pixel_size = self.vid.pixel_size
Esempio n. 10
0
        defaultextension=".acrec",
    )

    if filename != "":
        # write data to file
        messagebox.showinfo(
            title="Export Successful",
            message="Exported current recording to {}".format(filename),
        )


root = Tk()
root.title("+R Recording Manager")
root.option_add("*tearOff", FALSE)

loadstatus = StringVar()
loadstatus.set(
    "+R Closed!"
)  # may want to adjust based on game open-ness among other things

root.geometry("400x400+200+200")

menubar = Menu(root)
root["menu"] = menubar
menu_file = Menu(menubar)
menubar.add_cascade(menu=menu_file, label="File")
menu_file.add_command(label="Import...", command=import_recording)
menu_file.add_command(label="Export", command=export_recording)

mainframe = ttk.Frame(root, padding="3 3 12 12")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
Esempio n. 11
0
        try:
            Stitch_arr = Stitch(MainDirectory, GCI_List[X], Path_List[X],
                                ImgPath_List[X], SlideID[X])
            Stitch_arr
        except:
            ErrorLog.write("Something is not right, unable to stitch: " +
                           GCI_List[X] + ", " + ImgPath_List[X] + ", " +
                           SlideID[X] + "\n")
            pass
    ErrorLog.write(
        "If this is the only line you see then everything went well! YAY!")
    ErrorLog.close()


#Main Directory Selection
MainDirectory_Var = StringVar()
MainLabel = Label(gui, text="Choose Directory")
MainLabel.grid(row=0, column=0)
Direc_Entry = Entry(gui, textvariable=MainDirectory_Var)
Direc_Entry.grid(row=0, column=1)
btnFind = ttk.Button(gui, text="Browse Folder", command=getMainDirectory)
btnFind.grid(row=0, column=2)

#XLSX File Selection
OME_XLSX_Var = StringVar()
OMELabel = Label(gui, text="Choose XLSX File")
OMELabel.grid(row=1, column=0)
XLSX_Entry = Entry(gui, textvariable=OME_XLSX_Var)
XLSX_Entry.grid(row=1, column=1)
btnXLSX = ttk.Button(gui, text="Browse Files", command=getXLSX)
btnXLSX.grid(row=1, column=2)
Esempio n. 12
0
def button_start_clicked():
    print(filename.get())
    if filename.get() == "":
        messagebox.showerror(title="警告",
                             message="ファイルが選択されていません".format(filename.get()))
    else:
        messagebox.showinfo(title="結果",
                            message="選択したファイルは{0}です".format(filename.get()))


frame_select_file = ttk.Frame(root, padding=10)
frame_select_file.grid()

# ファイル名ラベル
s = StringVar()
s.set('file >>')
label_open = ttk.Label(frame_select_file, textvariable=s)
label_open.grid(row=0, column=0)

# 選択したファイル名
filename = StringVar()
entry_filename = ttk.Entry(frame_select_file, textvariable=filename, width=30)
entry_filename.grid(row=0, column=1)

button_open = ttk.Button(frame_select_file,
                         text='open',
                         command=button_open_clicked)
button_open.grid(row=0, column=2)

button_start = ttk.Button(root, text='start', command=button_start_clicked)
Esempio n. 13
0
        del dd


root = Tk()

root.title('My Books DB')
root.configure(background='light blue')
root.geometry("1100x700")
#root.resizable(width=False,height=False)

title_label = ttk.Label(root,
                        text='Title: ',
                        background='blue',
                        font=("TkDefaultFont", 16))
title_label.grid(row=0, column=0, sticky=W)
title_text = StringVar()
title_entry = ttk.Entry(root, width=16, textvariable=title_text)
title_entry.grid(row=0, column=1, sticky=W)

author_label = ttk.Label(root,
                         text='Author: ',
                         background='blue',
                         font=("TkDefaultFont", 16))
author_label.grid(row=0, column=2, sticky=W)
author_text = StringVar()
author_entry = ttk.Entry(root, width=16, textvariable=author_text)
author_entry.grid(row=0, column=3, sticky=W)

genre_label = ttk.Label(root,
                        text='Genre: ',
                        background='blue',
Esempio n. 14
0
 def __init__(self,master):
     self.master=master
     master.title("Movie Recommender System")
       
     self.labelmain = Label(master, text="Enter The Details of Users! Maximum 5 Users!")
     self.labelmain.grid(columnspan=5, sticky=W)
     
     self.labelage = Label(master, text="Age")
     self.labelage.grid(row= 3, column=2)
    
     self.labelgender = Label(master, text="Gender(M/F)")
     self.labelgender.grid(row=3, column=3)
    
     self.labelocc = Label(master, text="Occupation ID")
     self.labelocc.grid(row=3, column=4)
    
     self.labelzip = Label(master, text="Zip-Code")
     self.labelzip.grid(row=3, column=5)
    
     self.labeluser1 = Label(master, text="User 1 :")
     self.labeluser1.grid(row=4, column=1)
    
     self.labeluser2 = Label(master, text="User 2 :")
     self.labeluser2.grid(row=5, column=1)
    
     self.labeluser3 = Label(master, text="User 3 :")
     self.labeluser3.grid(row=6, column=1)
    
     self.labeluser4 = Label(master, text="User 4 :")
     self.labeluser4.grid(row=7, column=1)
    
     self.labeluser5 = Label(master, text="User 5 :")
     self.labeluser5.grid(row=8, column=1)
     
     #Drop down menu for age field        
     self.varage = StringVar(root)
     self.varage.set('Select' )
     self.agechoices = {'Select':'', 'Under 18':1, '18-24':18, '25-34':25, '35-44':35,'45-49':45, '50-55':50, '56+':56}
     self.ageoption = OptionMenu(root, self.varage, *self.agechoices.keys())
     self.varage1 = StringVar(root)
     self.varage1.set('Select')
     self.agechoices1 = {'Select':'', 'Under 18':1, '18-24':18, '25-34':25, '35-44':35,'45-49':45, '50-55':50, '56+':56}
     self.ageoption1 = OptionMenu(master, self.varage1, *self.agechoices1.keys())
     self.varage2 = StringVar(root)
     self.varage2.set('Select' )
     self.agechoices2 = {'Select':'', 'Under 18':1, '18-24':18, '25-34':25, '35-44':35,'45-49':45, '50-55':50, '56+':56}
     self.ageoption2 = OptionMenu(master, self.varage2, *self.agechoices2.keys())
     self.varage3 = StringVar(root)
     self.varage3.set('Select' )
     self.agechoices3 = {'Select':'', 'Under 18':1, '18-24':18, '25-34':25, '35-44':35,'45-49':45, '50-55':50, '56+':56}
     self.ageoption3 = OptionMenu(master, self.varage3, *self.agechoices3.keys())
     self.varage4 = StringVar(root)
     self.varage4.set('Select' )
     self.agechoices4 = {'Select':'', 'Under 18':1, '18-24':18, '25-34':25, '35-44':35,'45-49':45, '50-55':50, '56+':56}
     self.ageoption4 = OptionMenu(master, self.varage4, *self.agechoices4.keys())
    
     #Drop down menu for gender field
     self.vargen = StringVar(root)
     self.vargen.set('Select' )
     self.genchoices = {'Select':'', 'Male':'M','Female':'F'}
     self.genoption = OptionMenu(root, self.vargen, *self.genchoices.keys())
     self.vargen1 = StringVar(root)
     self.vargen1.set('Select' )
     self.genchoices1 = {'Select':'', 'Male':'M','Female':'F'}
     self.genoption1 = OptionMenu(root, self.vargen1, *self.genchoices1.keys())
     self.vargen2 = StringVar(root)
     self.vargen2.set('Select' )
     self.genchoices2 = {'Select':'', 'Male':'M','Female':'F'}
     self.genoption2 = OptionMenu(root, self.vargen2, *self.genchoices2.keys())
     self.vargen3 = StringVar(root)
     self.vargen3.set('Select' )
     self.genchoices3 = {'Select':'', 'Male':'M','Female':'F'}
     self.genoption3 = OptionMenu(root, self.vargen3, *self.genchoices3.keys())
     self.vargen4 = StringVar(root)
     self.vargen4.set('Select' )
     self.genchoices4 = {'Select':'', 'Male':'M','Female':'F'}
     self.genoption4 = OptionMenu(root, self.vargen4, *self.genchoices4.keys())
     
     #Drop Down menu for Occupation field
     self.varocc = StringVar(root)
     self.varocc.set('Select' )
     self.occchoices = {'Select':'', 'other or not specified':0, 'academic/educator':1, 'artist':2, 'clerical/admin':3,'college/grad student':4, 'customer service':5, 'doctor/health care':6,'executive/managerial':7,'farmer':8,'homemaker':9,'K-12 student':10,'lawyer':11,'programmer':12,'retired':13,'sales/marketing':14,'scientist':15,'self-employed':16,'technician/engineer':17,'tradesman/craftsman':18,'unemployed':19,'writer':20}
     self.occoption = OptionMenu(root, self.varocc, *self.occchoices.keys())
     self.varocc1 = StringVar(root)
     self.varocc1.set('Select' )
     self.occchoices1 = {'Select':'', 'other or not specified':0, 'academic/educator':1, 'artist':2, 'clerical/admin':3,'college/grad student':4, 'customer service':5, 'doctor/health care':6,'executive/managerial':7,'farmer':8,'homemaker':9,'K-12 student':10,'lawyer':11,'programmer':12,'retired':13,'sales/marketing':14,'scientist':15,'self-employed':16,'technician/engineer':17,'tradesman/craftsman':18,'unemployed':19,'writer':20}
     self.occoption1 = OptionMenu(root, self.varocc1, *self.occchoices1.keys())
     self.varocc2 = StringVar(root)
     self.varocc2.set('Select' )
     self.occchoices2 = {'Select':'', 'other or not specified':0, 'academic/educator':1, 'artist':2, 'clerical/admin':3,'college/grad student':4, 'customer service':5, 'doctor/health care':6,'executive/managerial':7,'farmer':8,'homemaker':9,'K-12 student':10,'lawyer':11,'programmer':12,'retired':13,'sales/marketing':14,'scientist':15,'self-employed':16,'technician/engineer':17,'tradesman/craftsman':18,'unemployed':19,'writer':20}
     self.occoption2 = OptionMenu(root, self.varocc2, *self.occchoices2.keys())
     self.varocc3 = StringVar(root)
     self.varocc3.set('Select' )
     self.occchoices3 = {'Select':'', 'other or not specified':0, 'academic/educator':1, 'artist':2, 'clerical/admin':3,'college/grad student':4, 'customer service':5, 'doctor/health care':6,'executive/managerial':7,'farmer':8,'homemaker':9,'K-12 student':10,'lawyer':11,'programmer':12,'retired':13,'sales/marketing':14,'scientist':15,'self-employed':16,'technician/engineer':17,'tradesman/craftsman':18,'unemployed':19,'writer':20}
     self.occoption3 = OptionMenu(root, self.varocc3, *self.occchoices3.keys())
     self.varocc4 = StringVar(root)
     self.varocc4.set('Select' )
     self.occchoices4 = {'Select':'', 'other or not specified':0, 'academic/educator':1, 'artist':2, 'clerical/admin':3,'college/grad student':4, 'customer service':5, 'doctor/health care':6,'executive/managerial':7,'farmer':8,'homemaker':9,'K-12 student':10,'lawyer':11,'programmer':12,'retired':13,'sales/marketing':14,'scientist':15,'self-employed':16,'technician/engineer':17,'tradesman/craftsman':18,'unemployed':19,'writer':20}
     self.occoption4 = OptionMenu(root, self.varocc4, *self.occchoices4.keys())
     
     #Assignment of values provided by user for age
     self.u1age = self.ageoption
     self.u1age.grid(row=4, column =2)
     self.u2age = self.ageoption1
     self.u2age.grid(row=5, column =2)   
     self.u3age = self.ageoption2
     self.u3age.grid(row=6, column =2)       
     self.u4age = self.ageoption3
     self.u4age.grid(row=7, column =2)       
     self.u5age = self.ageoption4
     self.u5age.grid(row=8, column =2)
     
     #Assignment of values provided by user for gender
     self.u1gender = self.genoption
     self.u1gender.grid(row=4, column =3)       
     self.u2gender = self.genoption1
     self.u2gender.grid(row=5, column =3)       
     self.u3gender = self.genoption2
     self.u3gender.grid(row=6, column =3)       
     self.u4gender = self.genoption3
     self.u4gender.grid(row=7, column =3)       
     self.u5gender = self.genoption4
     self.u5gender.grid(row=8, column =3)
     
     #Assignment of values provided by user for occupation
     self.u1occ = self.occoption
     self.u1occ.grid(row=4, column =4)       
     self.u2occ = self.occoption1
     self.u2occ.grid(row=5, column =4)       
     self.u3occ = self.occoption2
     self.u3occ.grid(row=6, column =4)       
     self.u4occ = self.occoption3
     self.u4occ.grid(row=7, column =4)       
     self.u5occ = self.occoption4
     self.u5occ.grid(row=8, column =4)       
     
     #Assignment of values provided by user for zip-code entry field
     self.u1zip = Entry(master)
     self.u1zip.grid(row=4, column =5)       
     self.u2zip = Entry(master)
     self.u2zip.grid(row=5, column =5)       
     self.u3zip = Entry(master)
     self.u3zip.grid(row=6, column =5)
     self.u4zip = Entry(master)
     self.u4zip.grid(row=7, column =5)
     self.u5zip = Entry(master)
     self.u5zip.grid(row=8, column =5)
    
     
     #submit button : it will call recommend method upon a mouse click 
     self.submit_button = Button(master, text="Recommend Movies!", command=self.recommend)
     self.submit_button.grid(row=9, column=3)
Esempio n. 15
0
    def buildFrame(self):
        """Contruct frame widgets and initialize data."""
        if self.built:
            return

        # Ensure all required parts of the conflict model are properly set-up.
        self.conflict.reorderOptionsByDM()
        self.conflict.options.set_indexes()
        self.conflict.infeasibles.validate()
        self.conflict.recalculateFeasibleStates()

        self.lastBuildDMs = self.conflict.decisionMakers.export_rep()
        self.lastBuildOptions = self.conflict.options.export_rep()
        self.lastBuildInfeasibles = self.conflict.infeasibles.export_rep()

        # Define variables that will display in the infoFrame
        self.originalStatesText = StringVar(value='Original States: init')
        self.removedStatesText = StringVar(value='States Removed: init')
        self.feasStatesText = StringVar(value='States Remaining: init')

        # Define frame-specific variables
        self.warnText = StringVar(value='')

        # infoFrame: frame and label definitions (with master 'self.infoFrame')
        self.originalStatesLabel = ttk.Label(
            self.infoFrame, textvariable=self.originalStatesText)
        self.removedStatesLabel = ttk.Label(
            self.infoFrame, textvariable=self.removedStatesText)
        self.feasStatesLabel = ttk.Label(self.infoFrame,
                                         textvariable=self.feasStatesText)

        # helpFrame: frame and label definitions (with master 'self.helpFrame')
        self.helpLabel = ttk.Label(self.helpFrame,
                                   textvariable=self.helpVar,
                                   wraplength=150)

        # Define frame-specific input widgets (with 'self' as master)
        self.optsFrame = ttk.Frame(self)
        self.hSep = ttk.Separator(self, orient=VERTICAL)
        self.infeasFrame = ttk.Panedwindow(self, orient=HORIZONTAL)

        self.optsInp = RadiobuttonEntry(self.optsFrame, self.conflict)
        self.infeasDisp = TreeInfeas(self.infeasFrame, self.conflict)
        self.feasList = FeasDisp(self.infeasFrame, self.conflict)
        self.infeasFrame.add(self.infeasDisp)
        self.infeasFrame.add(self.feasList)

        # ########  preliminary gridding and option configuration

        # configuring the input frame
        self.grid(column=0, row=0, rowspan=5, sticky=NSEW)
        self.grid_remove()

        self.columnconfigure(2, weight=3)
        self.rowconfigure(0, weight=1)

        # configuring infoFrame & infoFrame widgets
        self.infoFrame.grid(column=2, row=0, sticky=NSEW, padx=3, pady=3)
        self.infoFrame.grid_remove()
        self.originalStatesLabel.grid(column=0, row=1, sticky=NSEW)
        self.removedStatesLabel.grid(column=0, row=2, sticky=NSEW)
        self.feasStatesLabel.grid(column=0, row=3, sticky=NSEW)

        # configuring helpFrame & helpFrame widgets
        self.helpFrame.grid(column=2, row=1, sticky=NSEW, padx=3, pady=3)
        self.helpFrame.grid_remove()
        self.helpLabel.grid(column=0, row=0, sticky=NSEW)

        # configuring frame-specific options
        self.optsFrame.columnconfigure(0, weight=1)
        self.optsFrame.rowconfigure(0, weight=1)
        self.optsFrame.grid(column=0, row=0, sticky=NSEW)

        self.infeasFrame.grid(column=2, row=0, sticky=NSEW)

        self.optsInp.grid(column=0, row=0, columnspan=2, sticky=NSEW)
        self.optsInp.bind('<<AddInfeas>>', self.addInfeas)
        self.optsInp.bind('<<AddMutEx>>', self.addMutEx)

        self.infeasDisp.bind('<<SelItem>>', self.selChg)
        self.infeasDisp.bind('<<ValueChange>>', self.refresh)

        self.hSep.grid(column=1, row=0, rowspan=10, sticky=NSEW)

        self.refresh()

        self.built = True
Esempio n. 16
0
   
    menubar.add_cascade(label="Ayuda",    menu=menu_ayuda)
     
    # SE AGREGA LA BARRA DE MENÚ A LA RAÍZ
    root.config(menu=menubar)

    ####################################### EDITOR DE TEXTO #######################################

    # EDITOR DE TEXTO
    my_editor = Example(frame)
    my_editor.pack(side="top", fill=tk.BOTH, expand=True)
    
    
    # ETIQUETAS PARA LA FILA Y COLUMNA ACTUAL

    fila = StringVar()
    colum = StringVar()

    filaL = tk.Label(frame, textvariable=fila)
    filaL.place(x=100, y=550, width=100, height=25)
    filaL.pack()

    columnaL = tk.Label(frame, textvariable=colum)
    columnaL.place(x=100, y=590, width=100, height=25)
    columnaL.pack()

    ######################################### CONSOLA #############################################

    consola = tk.Text(root, bg='black', fg='white', state=tk.DISABLED)
    consola.place(x=30, y=505, relwidth=0.965, relheight=0.350)
Esempio n. 17
0
    menu=fileMenu)  # Add "File" dropdown sub-menu in main menu bar
fileMenu.add_command(label="Quit",
                     command=quitDialog)  # Add commands in submenu
helpMenu = Menu(menuBar, tearoff=0)
menuBar.add_cascade(label="Help", menu=helpMenu)
helpMenu.add_command(label="About Food App", command=about)
fileMenu.add_separator()
helpMenu.add_command(label="Credits", command=credit)
window.config(menu=menuBar)

labelAppName = ttk.Label(window, text="FOOD MENU", padding=2)
labelAppName.config(font=("Courier", 20, "bold"))
labelAppName.grid(row=0, column=0, columnspan=4, pady=10)

#----- Text Fields -----#
txtSearch = StringVar()
entry1 = ttk.Entry(window, textvariable=txtSearch)
entry1.grid(row=1, column=0, columnspan=2, padx=(10, 0), sticky='NSEW')
bSearch = ttk.Button(window, text='Search',
                     command=searches)  # Search food button
bSearch.grid(row=1, column=2)

#----- Scale for Price Filtering -----#
scaleVar = tk.IntVar()
scaleVar.set(0)
wScale = ttk.Label(window, text="Max Price $", padding=2)
wScale.grid(row=2, column=0, padx=(10, 0), pady=2)
wScale = tk.Scale(window,
                  from_=0,
                  to=highestPrice(),
                  variable=scaleVar,
Esempio n. 18
0
                          offvalue=0,
                          variable=highlight_line)
themes_menu = Menu(menu_bar, tearoff=0)
view_menu.add_cascade(label='Themes', menu=themes_menu)

color_schemes = {
    'Default': '#000000.#FFFFFF',
    'Greygarious': '#83406A.#D1D4D1',
    'Aquamarine': '#5B8340.#D1E7E0',
    'Bold Beige': '#4B4620.#FFF0E1',
    'Cobalt Blue': '#ffffBB.#3333aa',
    'Olive Green': '#D1E7E0.#5B8340',
    'Night Mode': '#FFFFFF.#000000',
}

theme_choice = StringVar()
theme_choice.set('Default')
for k in sorted(color_schemes):
    themes_menu.add_radiobutton(label=k, variable=theme_choice)
menu_bar.add_cascade(label='View', menu=view_menu)

about_menu = Menu(menu_bar, tearoff=0)
about_menu.add_command(label='About')
about_menu.add_command(label='Help')
menu_bar.add_cascade(label='About', menu=about_menu)
root.config(menu=menu_bar)

shortcut_bar = Frame(root, height=25, background='light sea green')
shortcut_bar.pack(expand='no', fill='x')
line_number_bar = Text(root,
                       width=4,
Esempio n. 19
0
""" X """
from tkinter import Tk
from tkinter import ttk
from tkinter import StringVar

df = [
    "Test1", "Test2", "Test3", "Test4", "Test5", "Test6", "Test7", "Test8",
    "Test9"
]
i = 0
root = Tk()
root.title("String var")
root.geometry("500x500")

# TODO: Array ile işlenecek
testStringVar = StringVar(root)
testLabelStringVar = ttk.Label(root, textvariable=testStringVar)
testStringVar.set("Blank")
testLabelStringVar.grid(row=0, column=1)

listOfStrVar = []
listOfLabel = []
for i in range(len(df)):
    tempStr = StringVar(root)
    tempStr.set("Blank" + str(i))
    listOfStrVar.append(tempStr)
    tempLabel = ttk.Label(root, textvariable=listOfStrVar[i])
    listOfLabel.append(tempLabel)

print(len(listOfStrVar))
print(len(listOfLabel))
Esempio n. 20
0
        print(self + "-->" + value)
        super().set(value)
        # print(self+"-->"+value)


def retrieve():
    print(my_entry.get())
    print(my_entry2.get())


root = Tk()
root.geometry("200x150")

frame = Frame(root)
frame.pack()
int1 = StringVar()
int2 = MyStringVar()

d = MyStringVar()


# d.set(int1.get()+int2.get())
# print(d.get())
def changevalue(self):
    # d.set(int1.get() + int2.get())
    c = d.get()
    my_entry3.delete(0, END)
    my_entry3.insert(0, c)


my_entry = Entry(frame, width=20, textvariable=int1)
Esempio n. 21
0
    def __init__(self, controller, *args, **kwargs):
        ttk.Frame.__init__(self, *args, **kwargs)
        self.place(relwidth=1, relheight=1)
        self.controller = controller
        self.image = None
        self.raw_image = None
        self.edited_image = None
        self.tiles = []

        self.save_image = ImageTk.PhotoImage(
            load_image_object_from_bytes_array(FLOPPY_BYTES))

        left_column_container = Frame(self)
        left_column_container.pack(side="left", fill="both", expand=True)

        canvas_container = Frame(left_column_container)
        canvas_container.pack(side="top", fill="both", expand=True)
        self.canvas_height = 720
        self.canvas_width = 1080
        self.canvas = ResizableCanvas(canvas_container, relief="sunken")
        self.canvas.config(width=self.canvas_width,
                           height=self.canvas_height,
                           highlightthickness=0)
        self.canvas.place(relwidth=1, relheight=1)
        self.canvas_frame = Frame(self.canvas, border=0, highlightthickness=0)
        self.canvas_frame.config(width=self.canvas_width,
                                 height=self.canvas_height)
        self.canvas.create_window(0, 0, window=self.canvas_frame, anchor='nw')
        self.canvas.bind("<Motion>", self.on_mouse_move)
        self.canvas.bind("<Button-1>", self.on_left_click)

        sidebar_container = Frame(self)
        sidebar_container.pack(side="right", fill="y", expand=False)
        sidebar_container.configure(width=50)

        self.data_type_var = StringVar()
        self.data_type_var.set(DATA_OPTIONS[0])
        self.data_type_dropdown = OptionMenu(sidebar_container,
                                             self.data_type_var, *DATA_OPTIONS)
        self.data_type_dropdown.pack(side="top",
                                     fill="x",
                                     expand=False,
                                     padx=2)

        self.smoothing_button = LabeledCheckbutton("7-Day Smoothing", True,
                                                   sidebar_container)
        self.smoothing_button.pack(side="top", fill="x", expand=False, padx=2)
        self.us_button = LabeledCheckbutton("Total US Graph",
                                            True,
                                            sidebar_container,
                                            command=self.on_us_set)
        self.us_button.pack(side="top", fill="x", expand=False, padx=2)

        listbox_container = Frame(sidebar_container)
        listbox_container.pack(side="top", fill="y", expand=True)

        self.scrollbar = Scrollbar(listbox_container)
        self.scrollbar.pack(side="right", fill="y", padx=(0, 2))
        self.listbox = Listbox(listbox_container, selectmode="multiple")
        self.listbox.pack(side="right", fill="y", expand=True, padx=(2, 0))

        self.build_button = Button(
            sidebar_container,
            text="Build Graph",
            command=lambda: self.controller.threader.do(self.on_build))
        self.build_button.pack(side="top",
                               fill="x",
                               expand=False,
                               padx=4,
                               pady=4)

        for r in REGIONS:
            self.listbox.insert("end", r)
        self.listbox.config(yscrollcommand=self.scrollbar.set)
        self.scrollbar.config(command=self.listbox.yview)

        self.bind("<Configure>", self.on_configure)
        self.on_us_set()

        def first_run_async():
            save_button = Tile(self, self.save_image, self.save_image,
                               self.save)
            save_button.set_dimensions(10, 10, 25, 25)
            self.tiles.append(save_button)
            self.place_tiles()
            self.on_build()
            self.after(10, self.on_configure)

        self.controller.threader.do(first_run_async, [])
Esempio n. 22
0
    def __init__(self,
                 master,
                 options=[],
                 selected=None,
                 horizontal=False,
                 command=None,
                 grid=None,
                 align=None,
                 args=None,
                 visible=True,
                 enabled=None,
                 width=None,
                 height=None):
        """
        Creates a ButtonGroup

        :param Container master:
            The Container (App, Box, etc) the ButtonGroup will belong too.

        :param List option:
            A list of options to append to the ButtonGroup. If a 2D list is
            specified, the first element is the text, the second is the value,
            defaults to an empty list.

        :param string selected:
            The item in the ButtonGroup to select, defaults to `None`.

        :param string horizontal:
            If the ButtonGroup is to be displayed horizontally, defaults to
            `True`.

        :param callback command:
            The callback function to call when the ButtonGroup changes,
            defaults to `None`.

        :param List grid:
            Grid co-ordinates for the widget, required if the master layout
            is 'grid', defaults to `None`.

        :param string align:
            How to align the widget within the grid, defaults to None.

        :param callback args:
            A list of arguments to pass to the widgets `command`, defaults to
            `None`.

        :param bool visible:
            If the widget should be visible, defaults to `True`.

        :param bool enabled:
            If the widget should be enabled, defaults to `None`. If `None`
            the value is inherited from the master.

        :param int width:
            The starting width of the widget. Defaults to `None` and will auto
            size.

        :param int height:
            The starting height of the widget. Defaults to `None` and will auto
            size.
        """

        description = "[ButtonGroup] object with selected option \"" + str(
            selected) + "\""

        self._rbuttons = []  # List of RadioButton objects
        self._text_size = None
        self._font = None
        self._horizontal = horizontal

        # Create a Tk frame object to contain the RadioButton objects
        tk = Frame(master.tk)

        # Set (using StringVar set() method) the selected option **number**
        self._selected = StringVar(master=tk.winfo_toplevel())

        # ButtonGroup uses "grid" internally to sort the RadioButtons
        super(ButtonGroup,
              self).__init__(master, tk, description, "grid", grid, align,
                             visible, enabled, width, height)

        # Loop through the list given and setup the options
        self._options = []
        for option in options:
            self._options.append(self._parse_option(option))

        self._refresh_options()

        # set the initial value
        if selected is None and len(self._options) > 0:
            self.value = self._options[0][1]
        else:
            self.value = selected

        # Add a command if there was one
        self.update_command(command, args)

        # override the event manager and associate the button group and the
        # radio buttons to it
        option_tks = [option.tk for option in self._rbuttons]
        self._events = EventManager(self, self.tk, *option_tks)

        # now the ButtonGroup is populate it, size it
        self.resize(width, height)
Esempio n. 23
0
var7=IntVar()
var8=IntVar()
var9=IntVar()
var10=IntVar()
var11=IntVar()
var12=IntVar()
var13=IntVar()
var14=IntVar()
var15=IntVar()
var16=IntVar()
var17=IntVar()
var18=IntVar()
var19=IntVar()
var20=IntVar()
var21=IntVar()
var22=StringVar()
var23=IntVar()

var1.set(0)
var2.set(0)
var3.set(0)
var4.set(0)
var5.set(0)
var6.set(0)
var7.set(0)
var8.set(0)
var9.set(0)
var10.set(0)
var11.set(0)
var12.set(0)
var13.set(0)
Esempio n. 24
0
def args_parse():
    """args_parse() -> None

    parse comand line args
    """

    if len(sys.argv) == 2:
        file_name_label.set(sys.argv[1])
        open_file()
    elif len(sys.argv) == 3:
        file_name_label.set(sys.argv[1])
        open_file()

        global file_to_save
        file_to_save = sys.argv[2]


if __name__ == "__main__":
    root = Tk()
    file_name_label = StringVar()
    file_err_label = StringVar()
    search_label = StringVar()
    replace_label = StringVar()
    file_text = None
    file_name = ""
    last_search_label = ""
    last_index = "1.0"
    skip_flg = False

    main()
Esempio n. 25
0
    def __init__(self):
        self.args = parse_args()
        cfg = mmcv.Config.fromfile(self.args.config)
        self.window = Tk()
        self.menubar = Menu(self.window)

        self.info = StringVar()
        self.info_label = Label(
            self.window, bg='yellow', width=4, textvariable=self.info)

        self.listBox_img = Listbox(
            self.window, width=50, height=25, font=('Times New Roman', 10))
        self.listBox_obj = Listbox(
            self.window, width=50, height=12, font=('Times New Roman', 10))

        self.scrollbar_img = Scrollbar(
            self.window, width=15, orient='vertical')
        self.scrollbar_obj = Scrollbar(
            self.window, width=15, orient='vertical')

        self.listBox_img_info = StringVar()
        self.listBox_img_label = Label(
            self.window,
            font=('Arial', 11),
            bg='yellow',
            width=4,
            height=1,
            textvariable=self.listBox_img_info)

        self.listBox_obj_info = StringVar()
        self.listBox_obj_label1 = Label(
            self.window,
            font=('Arial', 11),
            bg='yellow',
            width=4,
            height=1,
            textvariable=self.listBox_obj_info)
        self.listBox_obj_label2 = Label(
            self.window,
            font=('Arial', 11),
            bg='yellow',
            width=4,
            height=1,
            text='Object Class : Score (IoU)')


        if cfg.dataset_type == 'VOCDataset':
            self.data_info = VOC_dataset(cfg, self.args)
        elif cfg.dataset_type == 'CocoDataset':
            self.data_info = COCO_dataset(cfg, self.args)

        self.info.set('DATASET: {}'.format(self.data_info.dataset))

        # load image and show it on the window
        self.img = self.data_info.get_img_by_index(0)
        self.photo = ImageTk.PhotoImage(self.img)
        self.label_img = Label(self.window, image=self.photo)

        self.show_det_txt = IntVar(value=1)
        self.checkbn_det_txt = Checkbutton(
            self.window,
            text='Text',
            font=('Arial', 10, 'bold'),
            variable=self.show_det_txt,
            command=self.change_img,
            fg='#0000FF')

        self.show_dets = IntVar(value=1)
        self.checkbn_det = Checkbutton(
            self.window,
            text='Detections',
            font=('Arial', 10, 'bold'),
            variable=self.show_dets,
            command=self.change_img,
            fg='#0000FF')

        self.show_gt_txt = IntVar(value=1)
        self.checkbn_gt_txt = Checkbutton(
            self.window,
            text='Text',
            font=('Arial', 10, 'bold'),
            variable=self.show_gt_txt,
            command=self.change_img,
            fg='#FF8C00')

        self.show_gts = IntVar(value=1)
        self.checkbn_gt = Checkbutton(
            self.window,
            text='Groundtruth',
            font=('Arial', 10, 'bold'),
            variable=self.show_gts,
            command=self.change_img,
            fg='#FF8C00')

        self.combo_label = Label(
            self.window,
            bg='yellow',
            width=10,
            height=1,
            text='Show Category',
            font=('Arial', 11))
        self.combo_category = ttk.Combobox(
            self.window,
            font=('Arial', 11),
            values=self.data_info.aug_category.combo_list)
        self.combo_category.current(0)

        self.th_label = Label(
            self.window,
            font=('Arial', 11),
            bg='yellow',
            width=10,
            height=1,
            text='Score Threshold')
        self.threshold = np.float32(0.5)
        self.th_entry = Entry(
            self.window,
            font=('Arial', 11),
            width=10,
            textvariable=StringVar(self.window, value=str(self.threshold)))
        self.th_button = Button(
            self.window, text='Enter', height=1, command=self.change_threshold)

        self.iou_th_label = Label(
            self.window,
            font=('Arial', 11),
            bg='yellow',
            width=10,
            height=1,
            text='IoU Threshold')
        self.iou_threshold = np.float32(0.5)
        self.iou_th_entry = Entry(
            self.window,
            font=('Arial', 11),
            width=10,
            textvariable=StringVar(self.window, value=str(self.iou_threshold)))
        self.iou_th_button = Button(
            self.window, text='Enter', height=1, command=self.change_iou_threshold)

        self.find_label = Label(
            self.window,
            font=('Arial', 11),
            bg='yellow',
            width=10,
            height=1,
            text='find')
        self.find_name = ''
        self.find_entry = Entry(
            self.window,
            font=('Arial', 11),
            width=10,
            textvariable=StringVar(self.window, value=str(self.find_name)))
        self.find_button = Button(
            self.window, text='Enter', height=1, command=self.findname)

        self.listBox_img_idx = 0

        # ====== ohter attribute ======
        self.img_name = ''
        self.show_img = None

        self.output = self.args.output

        if not os.path.isdir(self.output):
            os.makedirs(self.output)

        self.img_list = self.data_info.img_list

        # flag for find/threshold button switch focused element
        self.button_clicked = False
if __name__ == "__main__":
    loaded_model = joblib.load('model/posture_model_new.pkl')

    if (USE_TESTING_DATA):
        inputs, labels = comm.getTestingData()
        testNetwork(inputs, labels)
    else:
        #LAUNCH TKINTER UI IF USING WINDOWS
        root = ""
        labelText = ""
        if (not UBUNTU):
            from tkinter import Tk, StringVar, Label
            root = Tk()
            root.title("POSTURE DETECTION")
            root.geometry("400x100")
            labelText = StringVar()
            labelText.set('Starting...!')
            button = Label(root,
                           textvariable=labelText,
                           font=("Helvetica", 40))
            button.pack()
            root.update()

        roomNumber = 0  #Room number 0
        importFloorData(roomNumber)

        file = open('real_time_joints_data.txt', 'w+')
        index = 0

        #Initialization step
        #Extract data from sensor and take the lowest point of foot left & right
Esempio n. 27
0
	file.write(pc[0]+","+pc[1]+"\n")
file.close()

#Recuperar info al fitxer
file = open("Llistes/llistaPC.txt","r")
llista = file.readlines()
print("llista recuperada de l'arxiu",llista)
for item in llista:
	minillista=[]
	minillista=item.split(",")
	PC = minillista[0]
	print(PC)
	user = minillista[1].strip()
	print(user)

nomClient = StringVar(value="Nom Client ?")

############# FUNCIONS ###################

def selecionat():
    global llista
    global subllista
    if llistaDesplegable.get() == "PC 1": #si tria la opcio del deplegable: PC 1
        for element in llista:
            llistaAux = element.split(",")
            if llistaAux[0] == "PC1":
                llistaAux[1] = nomClient.get()
                llista[0] = llistaAux[0] + "," + llistaAux[1] + "\n"          

    if llistaDesplegable.get() == "PC 2": #si tria la opcio del deplegable: PC 2
        for element in llista:
Esempio n. 28
0
    def __init__(self, master):
        self.master = master

        self.planes = 1000
        self.sigma_photo = PhotoImage(file="./res/sigma_left.png")
        self.right_bracket_photo = PhotoImage(file="./res/sigma_right.png")

        self.label = Label(
            master,
            text="Porfavor ingrese los valores del tensor de esfuerzos.",
            font=("Times New Roman", 22))

        self.label.grid(columnspan=6, sticky='N')

        self.sigma_label = Label(master, image=self.sigma_photo)
        self.sigma_label.grid(rowspan=3, column=0, sticky='E')

        self.right_bracket = Label(master, image=self.right_bracket_photo)
        self.right_bracket.grid(rowspan=3, column=4, row=1, sticky='W')

        # Setting stringvars...
        self.x_11 = StringVar()
        self.x_12 = StringVar()
        self.x_13 = StringVar()
        self.x_21 = StringVar()
        self.x_22 = StringVar()
        self.x_23 = StringVar()
        self.x_31 = StringVar()
        self.x_32 = StringVar()
        self.x_33 = StringVar()

        self.x_11_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_11)
        self.x_12_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_12)
        self.x_13_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_13)

        self.x_21_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_21)
        self.x_22_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_22)
        self.x_23_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_23)

        self.x_31_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_31)
        self.x_32_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_32)
        self.x_33_entry = Entry(master,
                                justify='center',
                                textvariable=self.x_33)

        self.x_11_entry.grid(row=1, column=1)
        self.x_12_entry.grid(row=1, column=2)
        self.x_13_entry.grid(row=1, column=3)

        self.x_21_entry.grid(row=2, column=1)
        self.x_22_entry.grid(row=2, column=2)
        self.x_23_entry.grid(row=2, column=3)

        self.x_31_entry.grid(row=3, column=1)
        self.x_32_entry.grid(row=3, column=2)
        self.x_33_entry.grid(row=3, column=3)

        self.planes_label = Label(master, text="Número de planos: ")
        self.planes_label.grid(row=4, column=1)
        self.planes_entry = Entry(master, justify='center')
        self.planes_entry.insert(0, '1000')
        self.planes_entry.grid(row=4, column=2, padx=5)

        self.generate_btn = Button(master,
                                   text="Generar circulos de Mohr",
                                   command=self.generate_circles)
        self.generate_btn.grid(row=5, column=1, pady=25, padx=5)

        self.principal_stresses_btn = Button(
            master,
            text="Obtener esfuerzos principales",
            command=self.generate_principal_stresses)

        self.principal_stresses_btn.grid(row=5, column=2, pady=25, padx=5)

        self.clear_btn = Button(master,
                                text="Limpiar campos",
                                command=self.clear_fields)
        self.clear_btn.grid(row=5, column=3, pady=25, padx=5)

        self.quit_btn = Button(master, text="Salir", command=self.master.quit)
        self.quit_btn.grid(row=5, column=4, pady=25, padx=5)

        self.credits_label = Label(
            master,
            text="Software creado por Nicky Garcia F.\n" +
            "Tkinter, Matplotlib y NumPy son de sus respectivos autores.\n" +
            "Sigue la licencia MIT. Código fuente disponible en: " +
            "https://github.com/kotoromo",
            font=("Times New Roman", 9))
        self.credits_label.grid(sticky='S', columnspan=6, rowspan=3)

        # Cleaning...
        self.clear_fields()
Esempio n. 29
0
    def __init__(self,
                 master=None,
                 year=None,
                 month=None,
                 firstweekday=calendar.MONDAY,
                 locale=None,
                 activebackground='#b1dcfb',
                 activeforeground='black',
                 selectbackground='#003eff',
                 selectforeground='white',
                 command=None,
                 borderwidth=1,
                 relief="solid",
                 on_click_month_button=None):
        """
        WIDGET OPTIONS

            locale, firstweekday, year, month, selectbackground,
            selectforeground, activebackground, activeforeground,
            command, borderwidth, relief, on_click_month_button
        """

        if year is None:
            year = self.datetime.now().year

        if month is None:
            month = self.datetime.now().month

        self._selected_date = None

        self._sel_bg = selectbackground
        self._sel_fg = selectforeground

        self._act_bg = activebackground
        self._act_fg = activeforeground

        self.on_click_month_button = on_click_month_button

        self._selection_is_visible = False
        self._command = command

        ttk.Frame.__init__(self,
                           master,
                           borderwidth=borderwidth,
                           relief=relief)

        self.bind("<FocusIn>",
                  lambda event: self.event_generate('<<DatePickerFocusIn>>'))
        self.bind("<FocusOut>",
                  lambda event: self.event_generate('<<DatePickerFocusOut>>'))

        self._cal = _get_calendar(locale, firstweekday)

        # custom ttk styles
        style = ttk.Style(master)
        style.layout('L.TButton', ([('Button.focus', {
            'children': [('Button.leftarrow', None)]
        })]))
        style.layout('R.TButton', ([('Button.focus', {
            'children': [('Button.rightarrow', None)]
        })]))

        self._font = tkFont.Font(master)

        self._header_var = StringVar()

        # header frame and its widgets
        hframe = ttk.Frame(self)
        lbtn = ttk.Button(hframe,
                          style='L.TButton',
                          command=self._on_press_left_button)
        lbtn.pack(side=LEFT)

        self._header = ttk.Label(hframe,
                                 width=15,
                                 anchor=CENTER,
                                 textvariable=self._header_var)
        self._header.pack(side=LEFT, padx=12)

        rbtn = ttk.Button(hframe,
                          style='R.TButton',
                          command=self._on_press_right_button)
        rbtn.pack(side=LEFT)
        hframe.grid(columnspan=7, pady=4)

        self._day_labels = {}

        days_of_the_week = self._cal.formatweekheader(3).split()

        for i, day_of_the_week in enumerate(days_of_the_week):
            ttk.Label(self, text=day_of_the_week,
                      background='grey90').grid(row=1,
                                                column=i,
                                                sticky=N + E + W + S)

        for i in range(6):
            for j in range(7):
                self._day_labels[i,
                                 j] = label = Tkinter.Label(self,
                                                            background="white")

                label.grid(row=i + 2, column=j, sticky=N + E + W + S)
                label.bind(
                    "<Enter>", lambda event: event.widget.configure(
                        background=self._act_bg, foreground=self._act_fg))
                label.bind(
                    "<Leave>",
                    lambda event: event.widget.configure(background="white"))

                label.bind("<1>", self._pressed)

        # adjust its columns width
        font = tkFont.Font(master)
        maxwidth = max(font.measure(text) for text in days_of_the_week)
        for i in range(7):
            self.grid_columnconfigure(i, minsize=maxwidth, weight=1)

        self._year = None
        self._month = None

        # insert dates in the currently empty calendar
        self._build_calendar(year, month)
Esempio n. 30
0
 def test_get(self):
     v = StringVar(self.root, "abc", "name")
     self.assertEqual("abc", v.get())
     self.root.globalsetvar("name", "value")
     self.assertEqual("value", v.get())