Ejemplo n.º 1
0
    def __init__(self, master):

        if 'normalPlottingBool.pkl' in os.listdir('misc'):
            normalPlottingBool = pickle.load(
                open('misc/normalPlottingBool.pkl', 'rb'))
        else:
            normalPlottingBool = True

        if not normalPlottingBool:
            global useModifiedDf, dataType, experimentDf, trueLabelDict, folderName, switchPage
            plottingParams = pickle.load(open('misc/plottingParams.pkl', 'rb'))
            useModifiedDf = False
            dataType = 'cell'
            experimentDf = plottingParams['df']
            trueLabelDict = createLabelDict(experimentDf)
            folderName = plottingParams['folderName']
            switchPage = 'a'

        plottableFigureDict = {
            '1d': ['histogram', 'kde'],
            'categorical': ['bar', 'violin', 'box', 'point', 'swarm', 'strip'],
            '2d': ['line', 'scatter'],
            '3d': ['heatmap']
        }

        tk.Frame.__init__(self, master)
        mainWindow = tk.Frame(self)
        mainWindow.pack(side=tk.TOP, padx=10)

        l1 = tk.Label(mainWindow,
                      text="What type of figure do you want to plot?",
                      pady=10).grid(row=0,
                                    column=0,
                                    columnspan=len(plottableFigureDict),
                                    sticky=tk.N)

        #global trueLabelDict
        #trueLabelDict = {}
        #trueLabelDict = createLabelDict(experimentDf)

        plotTypeRadioButtons = []
        plotSelectionString = tk.StringVar(value='1d/histogram')
        maxNumSubplots = 0
        for plotTypeIndex, plotTypeTitle in enumerate(plottableFigureDict):
            plotTypeTitleLabel = tk.Label(mainWindow, text=plotTypeTitle).grid(
                row=1, column=plotTypeIndex, sticky=tk.NW)
            temprblist = []
            tempselectionstring = []
            for subPlotTypeIndex, subPlotTitle in enumerate(
                    plottableFigureDict[plotTypeTitle]):
                rb = tk.Radiobutton(mainWindow,
                                    text=subPlotTitle,
                                    padx=20,
                                    variable=plotSelectionString,
                                    value=plotTypeTitle + '/' + subPlotTitle)
                rb.grid(row=subPlotTypeIndex + 2,
                        column=plotTypeIndex,
                        sticky=tk.NW)
                temprblist.append(rb)
            plotTypeRadioButtons.append(temprblist)
            if len(plottableFigureDict[plotTypeTitle]) > maxNumSubplots:
                maxNumSubplots = len(plottableFigureDict[plotTypeTitle])

        stripSwarmBool = tk.BooleanVar()
        cb = tk.Checkbutton(mainWindow,
                            text='Add strip/swarm points to categorical plot',
                            variable=stripSwarmBool,
                            pady=20)
        cb.grid(row=maxNumSubplots + 2,
                column=0,
                columnspan=len(plottableFigureDict))

        def collectInputs():
            global plotType
            global subPlotType
            global addDistributionPoints
            addDistributionPoints = stripSwarmBool.get()
            plotType, subPlotType = plotSelectionString.get().split('/')
            master.switch_frame(selectLevelsPage, 'a', 'b', 'c', 'd', 'e')

        def backCommand():
            #os.chdir('../../')
            if normalPlottingBool:
                master.switch_frame(PlotExperimentWindow, folderName,
                                    switchPage)
            else:
                master.switch_frame(plottingParams['homepage'], folderName,
                                    plottingParams['bp'],
                                    plottingParams['shp'])
            #master.switch_frame(PlotExperimentWindow,switchPage)

        buttonWindow = tk.Frame(self)
        buttonWindow.pack(side=tk.TOP)
        tk.Button(buttonWindow, text="OK",
                  command=lambda: collectInputs()).pack(side=tk.LEFT)
        tk.Button(buttonWindow, text="Back",
                  command=lambda: backCommand()).pack(side=tk.LEFT)
        tk.Button(buttonWindow, text="Quit",
                  command=lambda: quit()).pack(side=tk.LEFT)
Ejemplo n.º 2
0
#encoding:utf-8
import tkinter

win = tkinter.Tk()
win.geometry("400x400")

#绑定变量
#一组单选框要绑定同一变量
r = tkinter.StringVar()


def update():
    print(r.get())


radio1 = tkinter.Radiobutton(win,
                             text='one',
                             value='good',
                             variable=r,
                             command=update)
radio2 = tkinter.Radiobutton(win,
                             text='two',
                             value='nice',
                             variable=r,
                             command=update)

radio1.pack()
radio2.pack()

win.mainloop()
Ejemplo n.º 3
0
def page(adminPage):
    def lightMode():
        adminPage.config(bg="white")
        AzPetrolLabel2.config(bg="white")
        errorLabel.config(bg="white")

    def darkMode():
        adminPage.config(bg="gray15")
        AzPetrolLabel2.config(bg="gray15")
        errorLabel.config(bg="gray15")

    def fuelPrice(event=None):
        fuel = typeVar.get()
        if fuel in fuelPriceDic.keys():
            pricePerLiterLabel.config(text="Price Per L: " +
                                      str(fuelPriceDic[fuel]) + " AZN")

    def getData():
        fuelOrPrice = var.get()
        if (fuelOrPrice == 0):
            literEntry.config(state="normal")
            aznEntry.config(state="disabled")
        elif (fuelOrPrice == 1):
            aznEntry.config(state="normal")
            literEntry.config(state="disabled")
        else:
            literEntry.config(state="disabled")
            aznEntry.config(state="disabled")

    def fuelTotal(event=None):
        fuel_price = var.get()
        try:
            if (fuel_price == 0):
                liter = literEntry.get()
                if (str(liter).isalpha() == True or float(liter) < 0):
                    raise Exception(
                        "Liter value needs to be only digits and positive")
                priceL = 0
                fuelP = typeVar.get()
                priceL = float(liter) * fuelPriceDic[fuelP]
                totalFuelPriceLabel.config(text="Total Fuel Price: " +
                                           str(priceL) + " AZN")
                return priceL

            elif (fuel_price == 1):
                enteredPrice = aznEntry.get()
                if (str(enteredPrice).isalpha() == True
                        or float(enteredPrice) < 0):
                    raise Exception(
                        "Price needs to be only digits and positive")
                totalFuelPriceLabel.config(text="Total Fuel Price: " +
                                           str(enteredPrice) + " AZN")
                return enteredPrice
            else:
                return 0
        except Exception as ex:
            messagebox.showerror(title="Error", message=ex)

    def fuelClear():
        var.set(2)
        fuelTypesComboBox.set("")
        pricePerLiterLabel.config(text="Price Per L:")
        literEntry.config(state="normal")
        aznEntry.config(state="normal")
        literEntry.delete(0, "end")
        aznEntry.delete(0, "end")
        totalFuelPriceLabel.config(text="Total Fuel Price: 0 AZN")
        getData()

    def foodClear():
        hotVar.set(0)

        hamVar.set(0)

        friVar.set(0)

        cokeVar.set(0)
        hotDogAmountEntry.delete(0, "end")
        hamburgerAmountEntry.delete(0, "end")
        friesAmountEntry.delete(0, "end")
        cokeAmountEntry.delete(0, "end")

        foodCalc(event=None)

    def foodCalc(event=None):
        hotDog = hotVar.get()
        hamburger = hamVar.get()
        fries = friVar.get()
        coke = cokeVar.get()

        try:
            if (hotDog == 1):
                hotDogAmountEntry.config(state="normal")
                hotDogAmount = hotDogAmountEntry.get()
                if (hotDogAmount == ""):
                    hotDogAmountEntry.insert(0, "0")
                    hotDogTotal = 0
                elif (str(hotDogAmount).isdigit() == True
                      and float(hotDogAmount) >= 0):
                    hotDogTotal = float(hotDogAmount) * 4

                else:
                    raise Exception(
                        "Hot Dog amount must be digits and positive")
            else:
                hotDogAmountEntry.config(state="disabled")
                hotDogTotal = 0
            if hamburger == 1:
                hamburgerAmountEntry.config(state="normal")
                hamburgerAmount = hamburgerAmountEntry.get()
                if (hamburgerAmount == ""):
                    hamburgerAmountEntry.insert(0, "0")
                    hamburgerTotal = 0
                elif (str(hamburgerAmount).isdigit() == True
                      and float(hamburger) >= 0):
                    hamburgerTotal = float(hamburgerAmount) * 5.4
                else:
                    raise Exception(
                        "Hamburger amount must be digits and positive")
            else:
                hamburgerAmountEntry.config(state="disabled")
                hamburgerTotal = 0

            if (fries == 1):
                friesAmountEntry.config(state="normal")
                friesAmount = friesAmountEntry.get()
                if (friesAmount == ""):
                    friesAmountEntry.insert(0, "0")
                    friesTotal = 0
                elif (str(friesAmount).isdigit() == True
                      and float(friesAmount) >= 0):
                    friesTotal = float(friesAmount) * 3
                else:
                    raise Exception("Fries amount must be digits and positive")
            else:
                friesAmountEntry.config(state="disabled")
                friesTotal = 0

            if (coke == 1):
                cokeAmountEntry.config(state="normal")
                cokeAmount = cokeAmountEntry.get()
                if (cokeAmount == ""):
                    cokeAmountEntry.insert(0, "0")
                    cokeTotal = 0
                elif (str(cokeAmount).isdigit() == True
                      and float(cokeAmount) >= 0):
                    cokeTotal = float(cokeAmount) * 2
                else:
                    raise Exception("Coke amount must be digits and positive")
            else:
                cokeAmountEntry.config(state="disabled")
                cokeTotal = 0
            totalFoodPrice = hotDogTotal + hamburgerTotal + friesTotal + cokeTotal

            totalFoodLabel.config(text="Total Food Price: " +
                                  str(totalFoodPrice) + " AZN")
            return totalFoodPrice

        except Exception as ex:
            messagebox.showerror(title="Error", message=ex)

    def calculateAll():
        hotDog1 = hotVar.get()
        hamburger1 = hamVar.get()
        fries1 = friVar.get()
        coke1 = cokeVar.get()
        hotDogAmount1 = hotDogAmountEntry.get()
        hamburgerAmount1 = hamburgerAmountEntry.get()
        friesAmount1 = friesAmountEntry.get()
        cokeAmount1 = cokeAmountEntry.get()
        fuel_price = var.get()

        price1 = fuelTotal(event=None)
        price2 = foodCalc(event=None)

        if (str(price1).isalpha() == False and str(price2).isalpha() == False):
            total = float(price1) + float(price2)
            totalPrice.config(text=total)
        import random
        from datetime import datetime
        timestamp = datetime.timestamp(datetime.now())
        filename = "check" + str(random.randrange(
            10000, 1000000)) + str(timestamp) + ".txt"
        file = open("C:\\Users\\Sanan\\Desktop\\" + filename,
                    "w",
                    encoding="utf-8")
        file.write("\n\n")
        file.write("         AZPETROL")
        file.write("\n\n\n")
        date = datetime.now()
        file.write(f"Date: {str(date)[:19]}")

        file.write("\n\n\n")
        file.write("Product   Amount    Price\n")
        file.write("___________________________")
        file.write("\n")
        isTrue = True
        allStatements = []

        if (hotDog1 == 1):
            if (str(hotDogAmount1).isalpha() == False):
                if (int(hotDogAmount1) > 0):
                    file.write("HotDog" + " " * 6 + hotDogAmount1 + " " *
                               (8 - len(hotDogAmount1)) +
                               str(float(int(hotDogAmount1) * 4)) + " AZN" +
                               "\n")
            else:
                isTrue = False
                allStatements.append(isTrue)

        if (hamburger1 == 1):
            if (str(hamburgerAmount1.isalpha() == False)):
                if (int(hamburgerAmount1) > 0):
                    file.write("Hamburger" + " " * 3 + hamburgerAmount1 + " " *
                               (8 - len(hamburgerAmount1)) +
                               str(float(int(hamburgerAmount1) * 5.4)) +
                               " AZN" + "\n")
            else:
                isTrue = False
                allStatements.append(isTrue)

        if (fries1 == 1):
            if (str(friesAmount1.isalpha() == False)):
                if (int(friesAmount1) > 0):
                    file.write("Fries" + " " * 7 + friesAmount1 + " " *
                               (8 - len(friesAmount1)) +
                               str(float(int(friesAmount1) * 3)) + " AZN" +
                               "\n")
            else:
                isTrue = False
                allStatements.append(isTrue)

        if (coke1 == 1):
            if (str(cokeAmount1.isalpha() == False)):
                if (int(cokeAmount1) > 0):
                    file.write("Coke" + " " * 8 + cokeAmount1 + " " *
                               (8 - len(cokeAmount1)) +
                               str(float(int(cokeAmount1) * 2)) + " AZN" +
                               "\n")
            else:
                isTrue = False
                allStatements.append(isTrue)

        if (fuel_price == 0):
            liter = literEntry.get()
            if (str(liter).isalpha() == False and float(liter) > 0):
                fuelP = typeVar.get()
                priceL = float(liter) * fuelPriceDic[fuelP]
                file.write(
                    str(fuelP) + " " * (12 - len(fuelP)) + str(liter) + "L" +
                    " " * (7 - len(liter)) + str(priceL) + " AZN" + "\n")
            else:

                isTrue = False
                allStatements.append(isTrue)

        if (fuel_price == 1):
            enteredPrice = aznEntry.get()
            if (str(enteredPrice).isalpha() == False
                    and float(enteredPrice) > 0):
                fuelP = typeVar.get()
                litres = float(enteredPrice) / fuelPriceDic[fuelP]
                file.write(
                    str(fuelP) + " " * (12 - len(fuelP)) + str(litres) + "L " +
                    " " * (7 - len(str(litres))) + str(enteredPrice) + " AZN" +
                    "\n")
            else:
                isTrue = False
                allStatements.append(isTrue)

        if (False in allStatements):
            pass
        else:
            file.write("__________________________\n")
            file.write("Total: " + " " * 13 + str(total) + " AZN\n")
            file.write("__________________________\n")
            file.write("Thank you for shopping with us!")
            file.close()
            calculateButton.config(state="disabled")

    def fullClear():
        foodClear()
        fuelClear()
        totalPrice.config(text="0.0")
        calculateButton.config(state="normal")

    def getfuelTypes():
        newTypes = fuelTypes
        return fuelTypes

    typeVar = tk.StringVar()
    adminPage.config(bg="white")
    adminPage.resizable(False, False)
    adminPage.geometry("1000x750")
    adminPage.title("AzPetrol Admin Page")
    adminPage.iconbitmap("Azpetrol_logo.ico")
    AzPetrolLabel2 = tk.Label(adminPage, image=AzPetrolPhoto, bg="white")
    AzPetrolLabel2.place(x=450, y=0)
    petrolFrame = tk.Frame(adminPage, width=400, height=400, bg="green")
    petrolFrame.place(x=50, y=150)
    gasolineLabel = tk.Label(adminPage,
                             text="Gasoline Station",
                             font=("Times", 15, "bold"),
                             bg="green")
    gasolineLabel.place(x=50, y=150)
    menuFrame = tk.Frame(adminPage, width=400, height=400, bg="green")
    menuFrame.place(x=550, y=150)
    errorLabel = tk.Label(adminPage,
                          text="",
                          font=("Times", 20, "bold"),
                          fg="red",
                          bg="white")
    errorLabel.place(x=50, y=50)
    allPriceFrame = tk.Frame(adminPage, width=900, height=150, bg="green")
    allPriceFrame.place(x=50, y=570)
    fuelLabel = tk.Label(adminPage,
                         text="Fuel Type:",
                         font=("Times", 20, "bold"),
                         bg="green")
    fuelLabel.place(x=50, y=200)

    fuelTypesComboBox = Combobox(adminPage,
                                 font=("Times", 20, "bold"),
                                 values=getfuelTypes(),
                                 width=15,
                                 textvariable=typeVar)
    fuelTypesComboBox.bind("<<ComboboxSelected>>", fuelPrice)
    fuelTypesComboBox.place(x=200, y=200)
    pricePerLiterLabel = tk.Label(adminPage,
                                  text="Price Per L:",
                                  font=("Times", 20, "bold"),
                                  bg="green")
    pricePerLiterLabel.place(x=50, y=250)
    var = tk.IntVar()
    var.set(2)
    literRadiobutton = tk.Radiobutton(adminPage,
                                      text="Liter:",
                                      variable=var,
                                      value=0,
                                      bg="green",
                                      font=("Times", 20, "bold"),
                                      command=getData)
    literRadiobutton.place(x=50, y=300)
    literEntry = tk.Entry(adminPage,
                          font=("Times", 20, "bold"),
                          state="disabled",
                          width=15)
    literEntry.place(x=200, y=300)
    literEntry.bind("<Return>", fuelTotal)
    aznRadiobutton = tk.Radiobutton(adminPage,
                                    text="Price:",
                                    variable=var,
                                    value=1,
                                    bg="green",
                                    font=("Times", 20, "bold"),
                                    command=getData)
    aznRadiobutton.place(x=50, y=350)
    aznEntry = tk.Entry(adminPage,
                        font=("Times", 20, "bold"),
                        state="disabled",
                        width=15)
    aznEntry.place(x=200, y=350)
    aznEntry.bind("<Return>", fuelTotal)
    totalFuelPriceLabel = tk.Label(adminPage,
                                   text="Total Fuel Price: 0 AZN",
                                   font=("Times", 20, "bold"),
                                   bg="green")
    totalFuelPriceLabel.place(x=50, y=400)
    fuelClearButton = tk.Button(adminPage,
                                text="Clear All",
                                font=("Times", 20, "bold"),
                                bg="green",
                                command=fuelClear)
    fuelClearButton.place(x=190, y=480)
    minicafeLabel = tk.Label(adminPage,
                             text="Mini Cafe",
                             font=("Times", 15, "bold"),
                             bg="green")
    minicafeLabel.place(x=550, y=150)
    hotVar = tk.IntVar()
    hotVar.set(0)
    hamVar = tk.IntVar()
    hamVar.set(0)
    friVar = tk.IntVar()
    friVar.set(0)
    cokeVar = tk.IntVar()
    cokeVar.set(0)

    hotDogCheckBox = tk.Checkbutton(adminPage,
                                    text="Hot Dog",
                                    variable=hotVar,
                                    font=("Times", 20, "bold"),
                                    bg="green",
                                    command=foodCalc)
    hotDogCheckBox.place(x=550, y=200)
    hotDogPriceLabel = tk.Label(adminPage,
                                text="4.00",
                                font=("Times", 20, "bold"))
    hotDogPriceLabel.place(x=700, y=200)
    hotDogAmountEntry = tk.Entry(adminPage,
                                 font=("Times", 20, "bold"),
                                 state="disabled",
                                 width=10)
    hotDogAmountEntry.insert(0, "0")
    hotDogAmountEntry.place(x=770, y=200)
    hotDogAmountEntry.bind("<Return>", foodCalc)

    hamburgerCheckBox = tk.Checkbutton(adminPage,
                                       text="Hamburger",
                                       variable=hamVar,
                                       font=("Times", 20, "bold"),
                                       bg="green",
                                       command=foodCalc)
    hamburgerCheckBox.place(x=550, y=250)
    hamburgerPriceLabel = tk.Label(adminPage,
                                   text="5.40",
                                   font=("Times", 20, "bold"))
    hamburgerPriceLabel.place(x=720, y=250)
    hamburgerAmountEntry = tk.Entry(adminPage,
                                    font=("Times", 20, "bold"),
                                    state="disabled",
                                    width=10)
    hamburgerAmountEntry.place(x=790, y=250)
    hamburgerAmountEntry.bind("<Return>", foodCalc)

    friesCheckBox = tk.Checkbutton(adminPage,
                                   text="Fries",
                                   variable=friVar,
                                   font=("Times", 20, "bold"),
                                   bg="green",
                                   command=foodCalc)
    friesCheckBox.place(x=550, y=300)
    friesPriceLabel = tk.Label(adminPage,
                               text="3.00",
                               font=("Times", 20, "bold"))
    friesPriceLabel.place(x=720, y=300)
    friesAmountEntry = tk.Entry(adminPage,
                                font=("Times", 20, "bold"),
                                state="disabled",
                                width=10)
    friesAmountEntry.place(x=790, y=300)
    friesAmountEntry.bind("<Return>", foodCalc)

    cokeCheckBox = tk.Checkbutton(adminPage,
                                  text="Coke",
                                  variable=cokeVar,
                                  font=("Times", 20, "bold"),
                                  bg="green",
                                  command=foodCalc)
    cokeCheckBox.place(x=550, y=350)
    cokePriceLabel = tk.Label(adminPage,
                              text="2.00",
                              font=("Times", 20, "bold"))
    cokePriceLabel.place(x=720, y=350)
    cokeAmountEntry = tk.Entry(adminPage,
                               font=("Times", 20, "bold"),
                               state="disabled",
                               width=10)
    cokeAmountEntry.place(x=790, y=350)
    cokeAmountEntry.bind("<Return>", foodCalc)

    totalFoodLabel = tk.Label(adminPage,
                              text="Total Food Price: 0 AZN",
                              font=("Times", 20, "bold"),
                              bg="green")
    totalFoodLabel.place(x=550, y=400)

    foodClearButton = tk.Button(adminPage,
                                text="Clear All",
                                font=("Times", 20, "bold"),
                                bg="green",
                                command=foodClear)
    foodClearButton.place(x=670, y=480)

    allpriceLabel = tk.Label(adminPage,
                             text="All Price",
                             font=("Times", 20, "bold"),
                             bg="green")
    allpriceLabel.place(x=50, y=570)

    calculateButton = tk.Button(adminPage,
                                text="Calculate",
                                font=("Times", 20, "bold"),
                                bg="white",
                                command=calculateAll)
    calculateButton.place(x=220, y=630)
    deleteAllButton = tk.Button(adminPage,
                                text="Delete All",
                                font=("Times", 20, "bold"),
                                bg="white",
                                command=fullClear)
    deleteAllButton.place(x=400, y=630)
    totalFrame = tk.Frame(adminPage, width=200, height=80, bg="white")
    totalFrame.place(x=670, y=630)
    aznLabel = tk.Label(adminPage,
                        text="AZN",
                        font=("Times", 15, "bold"),
                        bg="green")
    aznLabel.place(x=880, y=670)
    totalPrice = tk.Label(adminPage,
                          text="0.0",
                          font=("Times", 20, "bold"),
                          bg="white")
    totalPrice.place(x=670, y=630)

    lightModeButton = tk.Button(adminPage,
                                text="Light Mode",
                                font=("Times", 20, "bold"),
                                command=lightMode)
    lightModeButton.place(x=600, y=50)
    darkModeButton = tk.Button(adminPage,
                               text="Dark Mode",
                               font=("Times", 20, "bold"),
                               command=darkMode)
    darkModeButton.place(x=800, y=50)
Ejemplo n.º 4
0
Weight_lbl = ttk.Label(contentm, text='Weight in kg ?', font=('', 20, 'bold'))
Weight_entry = ttk.Entry(contentm,
                         font=('', 20, 'bold'),
                         width=10,
                         justify='right')
Weight_lbl.grid(row=3, column=0, sticky=(N, S, E, W), padx=5, pady=5)
Weight_entry.grid(row=3, column=1, sticky=(N, E), padx=5, pady=5)

n = tk.StringVar()
for s in range(len(sex)):
    tk.Radiobutton(contentm,
                   text=sex[s],
                   font=('', 20, 'bold'),
                   indicatoron=0,
                   var=n,
                   value=sex[s],
                   bg='navajo white').grid(row=5,
                                           column=(s),
                                           sticky=(N, S, E, W),
                                           padx=5,
                                           pady=5)
proph_dose_btn = tk.Button(contentm,
                           text='Prophylactic dose',
                           font=('', 20, 'bold'),
                           command=proph_dose,
                           bg='navajo white')
proph_dose_btn.grid(row=16, column=0, sticky=(N, S, E, W), columnspan=2)
bridging_dose_btn = tk.Button(contentm,
                              text='Bridging dose',
                              font=('', 20, 'bold'),
                              command=open_indication_window,
Ejemplo n.º 5
0
    def __init__(self, parent, root, nrows, ncolumns):
        AutostitchBaseFrame.__init__(self, parent, root, nrows, ncolumns)

        self.motionModelVar = tk.IntVar()

        tk.Label(self, text='Motion Model:').grid(row=0, column=2, sticky=tk.W)

        tk.Radiobutton(self,
                       text='Translation',
                       variable=self.motionModelVar,
                       value=alignment.eTranslate).grid(row=0,
                                                        column=3,
                                                        sticky=tk.W)

        tk.Radiobutton(self,
                       text='Homography',
                       variable=self.motionModelVar,
                       value=alignment.eHomography).grid(row=0,
                                                         column=3,
                                                         sticky=tk.E)

        self.motionModelVar.set(alignment.eHomography)

        tk.Label(self,
                 text='Percent Top Matches for Alignment:').grid(row=1,
                                                                 column=0,
                                                                 sticky=tk.W)

        self.matchPercentSlider = tk.Scale(self,
                                           from_=0.0,
                                           to=100.0,
                                           resolution=1,
                                           orient=tk.HORIZONTAL)
        self.matchPercentSlider.set(20.0)
        self.matchPercentSlider.grid(row=1, column=1, sticky=tk.W + tk.E)
        self.matchPercentSlider.bind("<ButtonRelease-1>", self.compute)

        tk.Label(self, text='Number of RANSAC Rounds:').grid(row=1,
                                                             column=2,
                                                             sticky=tk.W)

        # TODO: determine sane values for this
        self.nRANSACSlider = tk.Scale(self,
                                      from_=1,
                                      to=10000,
                                      resolution=10,
                                      orient=tk.HORIZONTAL)
        self.nRANSACSlider.set(500)
        self.nRANSACSlider.grid(row=1, column=3, sticky=tk.W + tk.E)
        self.nRANSACSlider.bind("<ButtonRelease-1>", self.compute)

        tk.Label(self, text='RANSAC Threshold:').grid(row=1,
                                                      column=4,
                                                      sticky=tk.W)

        # TODO: determine sane values for this
        self.RANSACThresholdSlider = tk.Scale(self,
                                              from_=0.1,
                                              to=100,
                                              resolution=0.1,
                                              orient=tk.HORIZONTAL)
        self.RANSACThresholdSlider.set(5)
        self.RANSACThresholdSlider.grid(row=1, column=5, sticky=tk.W + tk.E)
        self.RANSACThresholdSlider.bind("<ButtonRelease-1>", self.compute)

        tk.Label(self, text='Focal Length (pixels):').grid(row=2,
                                                           column=4,
                                                           sticky=tk.W)
        self.focalLengthEntry = tk.Entry(self)
        self.focalLengthEntry.insert(0, str(DEFAULT_FOCAL_LENGTH))
        self.focalLengthEntry.grid(row=2, column=5, sticky=tk.W + tk.E)

        tk.Label(self, text='k1:').grid(row=3, column=4, sticky=tk.W)
        self.k1Entry = tk.Entry(self)
        self.k1Entry.insert(0, str(DEFAULT_K1))
        self.k1Entry.grid(row=3, column=5, sticky=tk.W + tk.E)

        tk.Label(self, text='k2:').grid(row=4, column=4, sticky=tk.W)
        self.k2Entry = tk.Entry(self)
        self.k2Entry.insert(0, str(DEFAULT_K2))
        self.k2Entry.grid(row=4, column=5, sticky=tk.W + tk.E)
Ejemplo n.º 6
0
 def __init__(self):
     self.root = root = tkinter.Tk()
     self.Image = tkinter.StringVar()
     self.status = tkinter.StringVar()
     self.mstatus = tkinter.IntVar()  #关联是否批量转换
     self.fstatus = tkinter.IntVar()  #关联是否改变文件格式
     self.Image.set('bmp')
     self.mstatus.set(0)
     self.fstatus.set(0)
     label = tkinter.Label(root, text='输入百分比')
     label.place(x=5, y=5)
     self.entryNew = tkinter.Entry(root)
     self.entryNew.place(x=70, y=5)
     self.checkM = tkinter.Checkbutton(root,
                                       text='批量转换',
                                       command=self.OnCheckM,
                                       variable=self.mstatus,
                                       onvalue=1,
                                       offvalue=0)
     self.checkM.place(x=5, y=30)
     label = tkinter.Label(root, text='选择文件')
     label.place(x=5, y=55)
     self.entryFile = tkinter.Entry(root)
     self.entryFile.place(x=60, y=55)
     self.buttonBrowserFile = tkinter.Button(root,
                                             text='浏览',
                                             command=self.BrowserFile)
     self.buttonBrowserFile.place(x=200, y=55)
     label = tkinter.Label(root, text='选择目录')
     label.place(x=5, y=80)
     self.entryDir = tkinter.Entry(root, state=tkinter.DISABLED)
     self.entryDir.place(x=60, y=80)
     self.buttonBrowserDir = tkinter.Button(root,
                                            text='浏览',
                                            command=self.BrowserDir,
                                            state=tkinter.DISABLED)
     self.buttonBrowserDir.place(x=200, y=80)
     self.checkF = tkinter.Checkbutton(root,
                                       text='改变文件格式',
                                       command=self.OnCheckF,
                                       variable=self.fstatus,
                                       onvalue=1,
                                       offvalue=0)
     self.checkF.place(x=5, y=110)
     frame = tkinter.Frame(root)
     frame.place(x=10, y=130)
     labelTo = tkinter.Label(frame, text='To')
     labelTo.pack(anchor='w')
     self.rBmp = tkinter.Radiobutton(frame,
                                     variable=self.Image,
                                     value='bmp',
                                     text='BMP',
                                     state=tkinter.DISABLED)
     self.rBmp.pack(anchor='w')
     self.rJpg = tkinter.Radiobutton(frame,
                                     variable=self.Image,
                                     value='jpg',
                                     text='JPG',
                                     state=tkinter.DISABLED)
     self.rJpg.pack(anchor='w')
     self.rGif = tkinter.Radiobutton(frame,
                                     variable=self.Image,
                                     value='gif',
                                     text='GIF',
                                     state=tkinter.DISABLED)
     self.rGif.pack(anchor='w')
     self.rPng = tkinter.Radiobutton(frame,
                                     variable=self.Image,
                                     value='png',
                                     text='PNG',
                                     state=tkinter.DISABLED)
     self.rPng.pack(anchor='w')
     self.buttonConv = tkinter.Button(root, text='转换', command=self.Conv)
     self.buttonConv.place(x=100, y=175)
     self.labelStatus = tkinter.Label(root, textvariable=self.status)
     self.labelStatus.place(x=80, y=205)
Ejemplo n.º 7
0
                         text='Add plant',
                         command= lambda: addPlant(ent_plant.get(), garden))
lbl_add = tk.Label(frm_add)
lbl_plantName.pack()
ent_plant.pack()
btn_addPlant.pack()
lbl_add.pack()

frm_create = tk.Frame(n)
maxPlants = tk.StringVar(frm_create)
maxPlants.set("False")
lbl_size = tk.Label(frm_create, text='Yard size, square footage')
ent_size = tk.Entry(frm_create, width=15)
lbl_maxPlants = tk.Label(frm_create, text='Use maximum # of plants')
btn_True = tk.Radiobutton(frm_create, text='True',
                                            var=maxPlants,
                                            value="True")
btn_False = tk.Radiobutton(frm_create, text='False',
                                        var=maxPlants,
                                        value="False")
lbl_feature = tk.Label(frm_create, text='Organize plants by:')
feat = tk.StringVar(frm_create)
feat_option = tk.StringVar(frm_create)
feat.trace('w', updateOptions)
dropDown1 = tk.OptionMenu(frm_create, feat, *choosable_features)
dropDown2 = tk.OptionMenu(frm_create, feat_option, '')
feat.set(choosable_features[0])

btn_create = tk.Button(frm_create,
                       text='Create garden',
                       command= lambda: newGarden(int(ent_size.get()),
tree.heading("投資金額", text="投資金額")
tree.place(x=15, y=30, anchor='nw')
chosen = []
addtolist = tk.Button(background, text='加入清單', command=appendtoList)
addtolist.place(x=480, y=110)
delete = tk.Button(b2, text='清除表格內容重填', command=delete)
delete.place(x=130, y=5, anchor='nw')

q3 = tk.Label(b2,
              text='3. 對於您來說,您比較在意:(根據持有習慣選擇期間長度)',
              bg='white',
              font=('Microsoft JhengHei', 11),
              fg='black')
q3.place(x=30, y=150, anchor='nw')
v = tk.IntVar()
rdioOne = tk.Radiobutton(b2, text='短期分散風險程度', variable=v, value=1, bg='white')
rdioTwo = tk.Radiobutton(b2, text='長期分散風險程度', variable=v, value=2, bg='white')
rdioOne.place(x=45, y=180, anchor='nw')
rdioTwo.place(x=200, y=180, anchor='nw')

b3 = tk.Frame(app, bg='white', width=525, height=230)
b3.place(x=575, y=330, anchor='nw')
in2 = tk.Label(b3,
               text='推薦您選擇以下其中一支基金:',
               bg='white',
               font=('Microsoft JhengHei', 11),
               fg='black')
in2.place(x=10, y=5, anchor='nw')
t2 = ttk.Treeview(b3, show='headings', height=8)
t2["columns"] = ('排名', '基金名稱', '平均月報酬')
t2.column("排名", width=30)
Ejemplo n.º 9
0
window = tk.Tk()
window.title('My windows')
window.geometry('400x400')

var = tk.StringVar()
l = tk.Label(window, bg='yellow', width=20, text='Empty')
l.pack()


def print_selection():
    l.config(text='You have selected ' + var.get())


r1 = tk.Radiobutton(window,
                    text='Option A',
                    variable=var,
                    value='A',
                    command=print_selection)
r1.pack()
r2 = tk.Radiobutton(window,
                    text='Option B',
                    variable=var,
                    value='B',
                    command=print_selection)
r2.pack()
r3 = tk.Radiobutton(window,
                    text='Option C',
                    variable=var,
                    value='C',
                    command=print_selection)
r3.pack()
Ejemplo n.º 10
0
    def plot_make(self):
        self.root = Tk.Tk()
        self.root.configure(background='white')
        self.root.wm_title('UBC Resistivity Measurement')
        fig1, ax1, ax2, ax3 = self._build_fig()
        plt_win = FigureCanvasTkAgg(fig1, master=self.root)

        #  plt_win.show()

        plt_win.get_tk_widget().grid(row=1, column=4, columnspan=6, rowspan=6)

        Tk.Label(master=self.root, text='Setpoint (K):',
                 background='white').grid(row=2, column=0)
        Tbox = Tk.Entry(master=self.root)
        Tbox.insert('end', '{:0.03f}'.format(4.2))
        Tbox.grid(row=2, column=1)

        Tk.Label(master=self.root,
                 text='Logging Interval (s):',
                 background='white').grid(row=3, column=0)
        Ibox = Tk.Entry(master=self.root)
        Ibox.insert('end', '{:d}'.format(5))
        Ibox.grid(row=3, column=1)

        Tk.Label(master=self.root, text='Direction',
                 background='white').grid(row=4, column=0)

        HC_opt = Tk.IntVar()
        HC_opt = 0

        Tk.Radiobutton(master=self.root,
                       text='Cool',
                       variable=HC_opt,
                       value=-1,
                       background='white').grid(row=4, column=1)
        Tk.Radiobutton(master=self.root,
                       text='Heat',
                       variable=HC_opt,
                       value=1,
                       background='white').grid(row=4, column=2)

        def _run():
            self.running = True
            self.root.after(1000 * int(Ibox.get()), task)
            run_button['state'] = 'disabled'
            stop_button['state'] = 'normal'

        def _stop():
            self.running = False
            self.root.after_cancel(self.recur_id)
            self.recur_id = None
            stop_button['state'] = 'disabled'
            run_button['state'] = 'normal'

        def _quit():
            self.lakeshore._disconnect()
            self.voltmeter._disconnect()
            self.lockin._disconnect()
            print('Devices Disconnected. Now exiting.')
            self.root.quit()
            self.root.destroy()

        def _save():
            self.fnm = filedialog.asksaveasfilename(
                initialdir="/",
                title="Select file",
                filetypes=(("text files", "*.txt"), ("all files", "*.*")))

            if self.fnm[-4:] != '.txt':
                self.fnm = self.fnm + '.txt'

            self.write_header()

        run_button = Tk.Button(master=self.root, text='START', command=_run)
        run_button.grid(row=5, column=0)

        stop_button = Tk.Button(master=self.root,
                                text='STOP',
                                state="disabled",
                                command=_stop)
        stop_button.grid(row=6, column=0)

        sv_button = Tk.Button(master=self.root, text='SAVE', command=_save)
        sv_button.grid(row=5, column=1)

        qt_button = Tk.Button(master=self.root, text='QUIT', command=_quit)
        qt_button.grid(row=5, column=2)

        Tk.Label(master=self.root,
                 text='Temperature (K):',
                 background='white',
                 fg='red').grid(row=7, column=0)
        Tk.Label(master=self.root,
                 text='Sample Resistance (Ohm):',
                 background='white',
                 fg='blue').grid(row=7, column=1)
        Tk.Label(master=self.root,
                 text='Reference Voltage (V):',
                 background='white',
                 fg='black').grid(row=7, column=2)
        Tk.Label(master=self.root, text='Time (s)',
                 background='white').grid(row=7, column=7)

        def task():
            T = self.lakeshore._measure_T()
            Vr = self.voltmeter._do_acv_measure()
            Vs_x, Vs_y = self.lockin._measure_V()
            Vs = Vs_x + 1.0j * Vs_y
            self._add_data(T, Vs, Vr)
            self.write_dataline(-1)
            self.update_figure(fig1, (ax1, ax2, ax3))
            self.recur_id = self.root.after(int(1000 * float(Ibox.get())),
                                            task)

        Tk.mainloop()
Ejemplo n.º 11
0
root.title("SPACE INVADERS!")

# set the size
root.geometry("460x600")

# add an instructions label
instructions = tkinter.Label(root,
                             text="Arrow keys to move, "
                             "Space to fire weapon",
                             font=('Courier', 12))
instructions.pack()

v = tkinter.IntVar()

tkinter.Label(root,
              text="""Select your ship, 1 or 2""",
              justify=tkinter.LEFT,
              padx=20).pack()

tkinter.Radiobutton(root, text="Rigel Axiom", padx=20, variable=v,
                    value=1).pack(anchor=tkinter.W)

tkinter.Radiobutton(root, text="Voyager II", padx=20, variable=v,
                    value=2).pack(anchor=tkinter.W)

# add a score label
scoreLabel = tkinter.Label(root, text="Score Tracker: ", font=('Courier', 12))
scoreLabel.pack()

# start the GUI
root.mainloop()
Ejemplo n.º 12
0
    def __init__(self, master, fName, sPage):
        with open('misc/normalPlottingBool.pkl', 'wb') as f:
            pickle.dump(True, f)

        global folderName, switchPage

        folderName = fName
        switchPage = sPage

        tk.Frame.__init__(self, master)

        experimentNameWindow = tk.Frame(self)
        experimentNameWindow.pack(side=tk.TOP, padx=10, pady=10)
        experimentNameLabel = tk.Label(experimentNameWindow,
                                       text=folderName + ':').pack()

        mainWindow = tk.Frame(self)
        mainWindow.pack(side=tk.TOP, padx=10, pady=10)

        l2 = tk.Label(mainWindow, text="""Datatype: """)
        v2 = tk.StringVar(value='cyt')
        rb2a = tk.Radiobutton(mainWindow,
                              text="Cytokine",
                              padx=20,
                              variable=v2,
                              value='cyt')
        rb2b = tk.Radiobutton(mainWindow,
                              text="Cell",
                              padx=20,
                              variable=v2,
                              value='cell')
        rb2c = tk.Radiobutton(mainWindow,
                              text="Proliferation",
                              padx=20,
                              variable=v2,
                              value='prolif')
        rb2d = tk.Radiobutton(mainWindow,
                              text="Single Cell",
                              padx=20,
                              variable=v2,
                              value='singlecell')

        v3 = tk.BooleanVar(value=False)
        cb = tk.Checkbutton(mainWindow, padx=20, variable=v3)

        l2.grid(row=0, column=0)
        rb2a.grid(row=1, column=0, sticky=tk.W)
        rb2b.grid(row=2, column=0, sticky=tk.W)
        rb2c.grid(row=3, column=0, sticky=tk.W)
        rb2d.grid(row=4, column=0, sticky=tk.W)

        l3 = tk.Label(mainWindow, text='Modified?').grid(row=0,
                                                         column=1,
                                                         sticky=tk.W)
        cb.grid(row=1, column=1, sticky=tk.W)

        def collectInputs():
            global useModifiedDf
            modified = v3.get()
            useModifiedDf = modified
            if modified:
                modifiedString = '-modified'
            else:
                modifiedString = ''
            global dataType
            dataType = str(v2.get())
            global experimentDf
            if dataType != 'singlecell':
                experimentDf = pd.read_pickle(
                    'outputData/pickleFiles/' +
                    initialDataProcessing.dataTypeDataFrameFileNames[dataType]
                    + '-' + folderName + modifiedString + '.pkl')
                print(experimentDf)
            else:
                if 'initialSingleCellDf-channel-' + folderName + modifiedString + '.pkl' in os.listdir(
                        'outputData/pickleFiles/'):
                    experimentDf = pickle.load(
                        open(
                            'outputData/pickleFiles/' +
                            'initialSingleCellDf-channel-' + folderName +
                            modifiedString + '.pkl', 'rb'))
                else:
                    experimentDf = pd.read_hdf(
                        'outputData/pickleFiles/' +
                        'initialSingleCellDf-channel-' + folderName +
                        modifiedString + '.h5', 'df')
                if 'CellType' != experimentDf.index.names[0]:
                    print('wat')
                    experimentDf = pd.concat([experimentDf],
                                             keys=['TCells'],
                                             names=['CellType'])
            global trueLabelDict
            trueLabelDict = {}
            if experimentDf.columns.name == None:
                experimentDf.columns.name = 'Marker'
            experimentParametersBool = False
            for fn in os.listdir('misc'):
                if 'experimentParameters' in fn:
                    if expParamDict[dataType] in fn:
                        experimentParametersBool = True
                        experimentParameters = json.load(
                            open(
                                'misc/experimentParameters-' + folderName +
                                '-' + expParamDict[dataType] + '.json', 'r'))
            if experimentParametersBool:
                trueLabelDict = createLabelDictWithExperimentParameters(
                    experimentDf, experimentParameters)
            else:
                trueLabelDict = createLabelDict(experimentDf)
            master.switch_frame(PlotTypePage)

        buttonWindow = tk.Frame(self)
        buttonWindow.pack(side=tk.TOP, pady=10)

        tk.Button(buttonWindow, text="OK",
                  command=lambda: collectInputs()).grid(row=5, column=0)
        tk.Button(
            buttonWindow,
            text="Back",
            command=lambda: master.switch_frame(switchPage, folderName)).grid(
                row=5, column=1)
        tk.Button(buttonWindow, text="Quit", command=quit).grid(row=5,
                                                                column=2)
Ejemplo n.º 13
0
    def __init__(self, master):
        if 'experimentParameters-' + folderName + '-' + expParamDict[
                dataType] + '.json' in os.listdir('misc'):
            experimentParameters = json.load(
                open(
                    'misc/experimentParameters-' + folderName + '-' +
                    expParamDict[dataType] + '.json', 'r'))
        else:
            tempDict = {}
            stackedDf = experimentDf.stack()
            for level in stackedDf.index.names:
                levelValues = list(
                    pd.unique(stackedDf.index.get_level_values(level)))
                tempDict[level] = levelValues
            experimentParameters = {}
            experimentParameters['levelLabelDict'] = tempDict
        """ 
        global dataType
        if 'cell' in pickleFileName: 
            dataType = 'cell'
        elif 'cyt' in pickleFileName:
            dataType = 'cyt'
        elif 'prolif' in pickleFileName:
            dataType = 'prolif'
        else:
            dataType = ''
        """
        print('TLD 1')
        self.tld = trueLabelDict

        axisDict = {
            'categorical': ['X', 'Y'],
            '1d': ['Y'],
            '2d': ['X', 'Y'],
            '3d': ['X', 'Y', 'Colorbar']
        }
        scalingList = ['Linear', 'Logarithmic', 'Biexponential']
        axisSharingList = ['col', 'row', '']
        axisTitleDefaults = getDefaultAxisTitles()

        tk.Frame.__init__(self, master)

        mainWindow = tk.Frame(self)
        mainWindow.pack(side=tk.TOP, padx=10, pady=10)

        tk.Label(mainWindow, text='Title: ').grid(row=1, column=0, sticky=tk.W)
        for scaling, scalingIndex in zip(scalingList, range(len(scalingList))):
            tk.Label(mainWindow,
                     text=scaling + ' Scaling: ').grid(row=scalingIndex + 2,
                                                       column=0,
                                                       sticky=tk.W)
        tk.Label(mainWindow,
                 text='Linear Range (Biexponential Scaling): ').grid(
                     row=len(scalingList) + 2, column=0, sticky=tk.W)
        tk.Label(mainWindow,
                 text='Convert to numeric: ').grid(row=len(scalingList) + 3,
                                                   column=0,
                                                   sticky=tk.W)
        tk.Label(mainWindow,
                 text='Share axis across: ').grid(row=len(scalingList) + 4,
                                                  column=0,
                                                  sticky=tk.W)
        tk.Label(mainWindow,
                 text='Axis limits: ').grid(row=len(scalingList) + 5,
                                            column=0,
                                            sticky=tk.W)

        entryList = []
        scalingVariableList = []
        radioButtonList = []
        checkButtonList = []
        checkButtonVarList = []
        radioButtonList2 = []
        radioButtonVarList2 = []
        linearRangeScalingList = []
        limitEntryList = []
        for axis, axisIndex in zip(axisDict[plotType],
                                   range(len(axisDict[plotType]))):
            tk.Label(mainWindow,
                     text=axis + ' Axis').grid(row=0, column=axisIndex + 1)

            e1 = tk.Entry(mainWindow)
            e1.grid(row=1, column=axisIndex + 1)
            e1.insert(0, axisTitleDefaults[axisIndex])
            entryList.append(e1)

            axisRadioButtonList = []
            v = tk.StringVar(value='Linear')
            for scaling, scalingIndex in zip(scalingList,
                                             range(len(scalingList))):
                rb = tk.Radiobutton(mainWindow, variable=v, value=scaling)
                rb.grid(row=scalingIndex + 2, column=axisIndex + 1)
                axisRadioButtonList.append(rb)
            radioButtonList.append(axisRadioButtonList)
            scalingVariableList.append(v)

            e2 = tk.Entry(mainWindow)
            e2.grid(row=len(scalingList) + 2, column=axisIndex + 1)
            linearRangeScalingList.append(e2)

            b = tk.BooleanVar(value=False)
            cb = tk.Checkbutton(mainWindow, variable=b)
            cb.grid(row=len(scalingList) + 3, column=axisIndex + 1)
            checkButtonList.append(cb)
            checkButtonVarList.append(b)

            shareWindow = tk.Frame(mainWindow)
            shareWindow.grid(row=len(scalingList) + 4, column=axisIndex + 1)
            shareString = tk.StringVar(value='None')
            rb2a = tk.Radiobutton(shareWindow,
                                  variable=shareString,
                                  text='All',
                                  value='all')
            rb2b = tk.Radiobutton(shareWindow,
                                  variable=shareString,
                                  text='Row',
                                  value='row')
            rb2c = tk.Radiobutton(shareWindow,
                                  variable=shareString,
                                  text='Col',
                                  value='col')
            rb2d = tk.Radiobutton(shareWindow,
                                  variable=shareString,
                                  text='None',
                                  value='none')
            shareString.set('all')
            rb2a.grid(row=0, column=1)
            rb2b.grid(row=0, column=2)
            rb2c.grid(row=0, column=3)
            rb2d.grid(row=0, column=4)
            radioButtonList2.append([rb2a, rb2b])
            radioButtonVarList2.append(shareString)

            limitWindow = tk.Frame(mainWindow)
            limitWindow.grid(row=len(scalingList) + 5, column=axisIndex + 1)
            #ll = tk.Label(limitWindow,text='Lower:').grid(row=0,column=0)
            e3 = tk.Entry(limitWindow, width=5)
            e3.grid(row=0, column=1)
            #ul = tk.Label(limitWindow,text='Upper:').grid(row=0,column=2)
            e4 = tk.Entry(limitWindow, width=5)
            e4.grid(row=0, column=3)
            limitEntryList.append([e3, e4])

        def collectInputs(plotAllVar):
            plotOptions = {}
            for axis, axisIndex in zip(axisDict[plotType],
                                       range(len(axisDict[plotType]))):
                share = radioButtonVarList2[axisIndex].get()
                if share == 'none':
                    share = False
                plotOptions[axis] = {
                    'axisTitle':
                    entryList[axisIndex].get(),
                    'axisScaling':
                    scalingVariableList[axisIndex].get(),
                    'linThreshold':
                    linearRangeScalingList[axisIndex].get(),
                    'numeric':
                    checkButtonVarList[axisIndex].get(),
                    'share':
                    share,
                    'limit': [
                        limitEntryList[axisIndex][0].get(),
                        limitEntryList[axisIndex][1].get()
                    ]
                }

            plotSpecificDict = {}
            if subPlotType == 'kde':
                scaleBool = ipe.getRadiobuttonValues(
                    modeScaleRadiobuttonVarsDict)['scale to mode']
                if scaleBool == 'yes':
                    plotSpecificDict['scaleToMode'] = True
                else:
                    plotSpecificDict['scaleToMode'] = False
                plotSpecificDict['smoothing'] = int(
                    ipe.getSliderValues(smoothingSliderList,
                                        ['smoothing'])['smoothing'])

            useModifiedDf = False
            sName = titleEntry.get()
            subsettedDfList, subsettedDfListTitles, figureLevels, levelValuesPlottedIndividually = fpl.produceSubsettedDataFrames(
                experimentDf.stack().to_frame('temp'),
                fullFigureLevelBooleanList, includeLevelValueList, self.tld)
            fpl.plotFacetedFigures(
                folderName,
                plotType,
                subPlotType,
                dataType,
                subsettedDfList,
                subsettedDfListTitles,
                figureLevels,
                levelValuesPlottedIndividually,
                useModifiedDf,
                experimentDf,
                plotOptions,
                parametersSelected,
                addDistributionPoints,
                originalLevelValueOrders=experimentParameters[
                    'levelLabelDict'],
                subfolderName=sName,
                context=ipe.getRadiobuttonValues(
                    contextRadiobuttonVarsDict)['context'],
                height=float(heightEntry.get()),
                aspect=float(widthEntry.get()),
                titleBool=ipe.getRadiobuttonValues(
                    plotTitleRadiobuttonVarsDict)['plotTitle'],
                colwrap=int(colWrapEntry.get()),
                legendBool=ipe.getRadiobuttonValues(
                    legendRadiobuttonVarsDict)['legend'],
                outlierBool=ipe.getRadiobuttonValues(
                    outlierRadiobuttonVarsDict)['remove outliers'],
                plotAllVar=plotAllVar,
                titleAdjust=titleAdjustEntry.get(),
                plotSpecificDict=plotSpecificDict)

        titleWindow = tk.Frame(self)
        titleWindow.pack(side=tk.TOP, pady=10)
        tk.Label(titleWindow,
                 text='Enter subfolder for these plots (optional):').grid(
                     row=0, column=0)
        titleEntry = tk.Entry(titleWindow, width=15)
        titleEntry.grid(row=0, column=1)

        miscOptionsWindow = tk.Frame(self)
        miscOptionsWindow.pack(side=tk.TOP, pady=10)

        contextWindow = tk.Frame(miscOptionsWindow)
        contextWindow.grid(row=0, column=0, sticky=tk.N)
        contextRadiobuttonList, contextRadiobuttonVarsDict = ipe.createParameterSelectionRadiobuttons(
            contextWindow, ['context'],
            {'context': ['notebook', 'talk', 'poster']})

        figureDimensionWindow = tk.Frame(miscOptionsWindow)
        figureDimensionWindow.grid(row=0, column=1, sticky=tk.N)
        tk.Label(figureDimensionWindow,
                 text='figure dimensions').grid(row=0, column=0)
        tk.Label(figureDimensionWindow, text='height:').grid(row=1, column=0)
        tk.Label(figureDimensionWindow, text='width:').grid(row=2, column=0)
        heightEntry = tk.Entry(figureDimensionWindow, width=3)
        if plotType != '1d':
            heightEntry.insert(0, '5')
        else:
            heightEntry.insert(0, '3')
        widthEntry = tk.Entry(figureDimensionWindow, width=3)
        widthEntry.insert(0, '1')
        heightEntry.grid(row=1, column=1)
        widthEntry.grid(row=2, column=1)

        plotTitleWindow = tk.Frame(miscOptionsWindow)
        plotTitleWindow.grid(row=0, column=2, sticky=tk.N)
        plotTitleRadiobuttonList, plotTitleRadiobuttonVarsDict = ipe.createParameterSelectionRadiobuttons(
            plotTitleWindow, ['plotTitle'], {'plotTitle': ['yes', 'no']})

        legendWindow = tk.Frame(miscOptionsWindow)
        legendWindow.grid(row=0, column=3, sticky=tk.N)
        legendRadiobuttonList, legendRadiobuttonVarsDict = ipe.createParameterSelectionRadiobuttons(
            legendWindow, ['legend'], {'legend': ['yes', 'no']})

        colWrapWindow = tk.Frame(miscOptionsWindow)
        colWrapWindow.grid(row=0, column=4, sticky=tk.N)
        tk.Label(colWrapWindow, text='column wrap:').grid(row=0, column=0)
        colWrapEntry = tk.Entry(colWrapWindow, width=5)
        colWrapEntry.insert(0, '5')
        colWrapEntry.grid(row=1, column=0)

        titleAdjustWindow = tk.Frame(miscOptionsWindow)
        titleAdjustWindow.grid(row=0, column=5, sticky=tk.N)
        tk.Label(titleAdjustWindow,
                 text='title location (% of window):').grid(row=0, column=0)
        titleAdjustEntry = tk.Entry(titleAdjustWindow, width=5)
        titleAdjustEntry.insert(0, '')
        titleAdjustEntry.grid(row=1, column=0)

        outlierWindow = tk.Frame(miscOptionsWindow)
        outlierWindow.grid(row=0, column=6, sticky=tk.N)
        outlierRadiobuttonList, outlierRadiobuttonVarsDict = ipe.createParameterSelectionRadiobuttons(
            outlierWindow, ['remove outliers'],
            {'remove outliers': ['yes', 'no']})
        outlierRadiobuttonVarsDict['remove outliers'].set('no')

        if subPlotType == 'kde':
            #Scale to mode button
            subPlotSpecificWindow = tk.Frame(self)
            subPlotSpecificWindow.pack(side=tk.TOP, pady=10)
            modeScaleWindow = tk.Frame(subPlotSpecificWindow)
            modeScaleWindow.grid(row=0, column=0, sticky=tk.N)
            modeScaleRadiobuttonList, modeScaleRadiobuttonVarsDict = ipe.createParameterSelectionRadiobuttons(
                modeScaleWindow, ['scale to mode'],
                {'scale to mode': ['yes', 'no']})
            modeScaleRadiobuttonVarsDict['scale to mode'].set('no')
            #Smoothness (or bandwidth) slider
            smoothnessWindow = tk.Frame(subPlotSpecificWindow)
            smoothnessWindow.grid(row=0, column=1, sticky=tk.N)
            smoothingSliderList = ipe.createParameterAdjustmentSliders(
                smoothnessWindow, ['smoothing'], {'smoothing': [1, 99, 2, 27]})

        plotButtonWindow = tk.Frame(self)
        plotButtonWindow.pack(side=tk.TOP, pady=10)
        tk.Button(plotButtonWindow,
                  text="Generate First Plot",
                  command=lambda: collectInputs(False)).grid(row=0, column=0)
        tk.Button(plotButtonWindow,
                  text="Generate All Plots",
                  command=lambda: collectInputs(True)).grid(row=0, column=1)

        buttonWindow = tk.Frame(self)
        buttonWindow.pack(side=tk.TOP, pady=10)

        def okCommand():
            master.switch_frame(PlotTypePage)

        tk.Button(buttonWindow, text="OK",
                  command=lambda: okCommand()).grid(row=len(scalingList) + 4,
                                                    column=0)
        tk.Button(
            buttonWindow,
            text="Back",
            command=lambda: master.switch_frame(assignLevelsToParametersPage,
                                                includeLevelValueList)).grid(
                                                    row=len(scalingList) + 4,
                                                    column=1)
        tk.Button(buttonWindow, text="Quit",
                  command=lambda: quit()).grid(row=len(scalingList) + 4,
                                               column=2)
Ejemplo n.º 14
0
    def __init__(self, master, temp):
        parameterTypeDict = {
            'categorical': ['Color', 'Order', 'Row', 'Column', 'None'],
            '1d': ['Color', 'Row', 'Column', 'None'],
            '2d': [
                'Marker', 'Color', 'Size', 'Row', 'Column', 'X Axis Values',
                'None'
            ],
            '3d': ['Row', 'Column', 'X Axis Values', 'Y Axis Values']
        }

        tk.Frame.__init__(self, master)
        global includeLevelValueList
        includeLevelValueList = temp
        global parametersSelected
        parametersSelected = {}
        mainWindow = tk.Frame(self)
        mainWindow.pack(side=tk.TOP, padx=10, pady=10)

        l1 = tk.Label(
            mainWindow,
            text=
            'Which plotting parameter do you want to assign to each of your figure levels?',
            pady=10).grid(row=0, column=0, columnspan=len(figureLevelList))
        rblist = []
        parameterVarList = []
        for figureLevel, figureLevelIndex in zip(figureLevelList,
                                                 range(len(figureLevelList))):
            v = tk.IntVar()
            temprblist = []
            levelLabel = tk.Label(mainWindow, text=figureLevel + ':')
            levelLabel.grid(row=1, column=figureLevelIndex, sticky=tk.NW)
            for plottingParameter, parameterIndex in zip(
                    parameterTypeDict[plotType],
                    range(len(parameterTypeDict[plotType]))):
                rb = tk.Radiobutton(mainWindow,
                                    text=plottingParameter,
                                    padx=20,
                                    variable=v,
                                    value=parameterIndex)
                rb.grid(row=parameterIndex + 2,
                        column=figureLevelIndex,
                        sticky=tk.NW)
                temprblist.append(rb)
            rblist.append(temprblist)
            parameterVarList.append(v)

        def collectInputs():
            for parameterVar, levelName in zip(parameterVarList,
                                               figureLevelList):
                if parameterTypeDict[plotType][
                        parameterVar.get()] not in parametersSelected.keys():
                    parametersSelected[parameterTypeDict[plotType][
                        parameterVar.get()]] = levelName
                else:
                    if not isinstance(
                            parametersSelected[parameterTypeDict[plotType][
                                parameterVar.get()]], list):
                        parametersSelected[parameterTypeDict[plotType][
                            parameterVar.get()]] = [
                                parametersSelected[parameterTypeDict[plotType][
                                    parameterVar.get()]]
                            ] + [levelName]
                    else:
                        parametersSelected[parameterTypeDict[plotType][
                            parameterVar.get()]].append(levelName)
            master.switch_frame(plotElementsGUIPage)

        def quitCommand():
            exitBoolean = True
            quit()

        buttonWindow = tk.Frame(self)
        buttonWindow.pack(side=tk.TOP, pady=10)

        tk.Button(buttonWindow, text="OK",
                  command=lambda: collectInputs()).grid(
                      row=len(parameterTypeDict[plotType]) + 2, column=0)
        tk.Button(buttonWindow,
                  text="Back",
                  command=lambda: master.switch_frame(
                      selectLevelValuesPage, assignLevelsToParametersPage,
                      trueLabelDict, selectLevelsPage, 'a', 'b', 'c', 'd', 'e')
                  ).grid(row=len(parameterTypeDict[plotType]) + 2, column=1)
        tk.Button(buttonWindow, text="Quit",
                  command=lambda: quitCommand()).grid(
                      row=len(parameterTypeDict[plotType]) + 2, column=2)

def end():
    main.destroy()


def show_option():
    lb.configure(text="Option : {0}".format(color.get()))


color = tkinter.StringVar()
color.set("red")

radioButton_1 = tkinter.Radiobutton(main,
                                    variable=color,
                                    command=show_option,
                                    text="Red",
                                    value="red")
radioButton_2 = tkinter.Radiobutton(main,
                                    variable=color,
                                    command=show_option,
                                    text="Blue",
                                    value="blue")
radioButton_3 = tkinter.Radiobutton(main,
                                    variable=color,
                                    command=show_option,
                                    text="Yellow",
                                    value="yellow")

radioButton_1.pack()
radioButton_2.pack()
Ejemplo n.º 16
0
    def __init__(self):
        self.window = tk.Tk()
        self.log_texts = []
        self.logs = []
        self.scraper = None
        self.csv = True

        for i in range(5):
            self.log_texts.append(tk.StringVar(self.window))
            self.log_texts[i].set("")

        for i in range(5):
            self.logs.append(
                tk.Label(self.window, textvariable=self.log_texts[i]))

        self.window.geometry("450x500")
        self.window.title("Bangood Scraper")

        self.txt = tk.Entry(self.window, width=50)
        self.txtLabel = tk.Label(self.window, text="Enter product name")
        self.btnSet = tk.Button(self.window,
                                text="OK",
                                padx=50,
                                command=self.onOkClick)
        self.txtLabel.grid(column=0, row=0)
        self.txt.grid(column=0, row=1, sticky="e")
        self.btnSet.grid(column=1, row=1)
        self.radio_var = tk.IntVar()
        self.r1 = tk.Radiobutton(self.window,
                                 text="CSV",
                                 variable=self.radio_var,
                                 value=1,
                                 command=self.onRadioChange)
        self.r1.select()
        self.r2 = tk.Radiobutton(self.window,
                                 text="sqlite3 database",
                                 variable=self.radio_var,
                                 value=2,
                                 command=self.onRadioChange)
        self.r1.grid(column=0, row=2)
        self.r2.grid(column=1, row=2)

        self.pages_till_scrape_var = tk.IntVar()

        self.pages_to_scrape = tk.Entry(self.window, width=50)
        # self.pages_to_scrape.insert(0, "Enter comma separated numbers")
        # self.pages_to_scrape_radio = tk.Radiobutton(self.window, text="Scrape these pages", variable=self.pages_till_scrape_var, value=1, command=self.onPageRangeRadioClick) # 1-> comma separated list

        self.pages_till = tk.Entry(self.window, width=50)
        self.pages_till.insert(0, "Enter page number to scrape till")
        self.pages_to_scrape_radio2 = tk.Radiobutton(
            self.window,
            text="Scrape till this page",
            variable=self.pages_till_scrape_var,
            value=2,
            command=self.onPageRangeRadioClick)  # 2-> till
        self.pages_to_scrape_radio3 = tk.Radiobutton(
            self.window,
            text="Scrape All pages",
            variable=self.pages_till_scrape_var,
            value=3,
            command=self.onPageRangeRadioClick)  # 3 ->  All
        self.pages_to_scrape_radio3.select()
        self.btnStart = tk.Button(self.window,
                                  text="Start!",
                                  padx=50,
                                  command=self.onStartClick)

        self.pages_till["state"] = "disabled"
        self.pages_to_scrape["state"] = "disabled"
        self.pages_to_scrape_radio3["state"] = "disabled"
        self.pages_to_scrape_radio2["state"] = "disabled"
        # self.pages_to_scrape_radio["state"] = "disabled"
        self.btnStart["state"] = "disabled"

        self.pages_to_scrape_radio3.grid(column=0, row=3)
        # self.pages_to_scrape.grid(column=0, row=4)
        # self.pages_to_scrape_radio.grid(column=1, row=4)
        self.pages_till.grid(column=0, row=5)
        self.pages_to_scrape_radio2.grid(column=1, row=5)
        self.btnStart.grid(column=0, row=6)

        self.log_start_row = 7
        for log in self.logs:
            log.grid(column=0, row=self.log_start_row)
            self.log_start_row += 1

        # label = tk.Label(window, text="It worked").pack()
        self.window.mainloop()
Ejemplo n.º 17
0
root = tk.Tk() 
r = tk.IntVar()
# r.get()
# r = StrVar()

MODES = [
    
    ("Apple","apple"),
    ("Orange","orange"),
    ("Onion","onion"),
]

fruit = tk.StringVar()
for text, mode in MODES:
    tk.Radiobutton(root, text=text, variable=fruit, value=mode ).pack()
    # these buttons share the same Variable therefore they are grouped togther.

def clicked(value):
    global myLabel
    myLabel = tk.Label(text=f"{value}").pack()
    
tk.Radiobutton(root, text="Option 1", variable=r, value=1, command=lambda:clicked(r.get())).pack()
tk.Radiobutton(root, text="Option 2", variable=r, value=2, command=lambda:clicked(r.get())).pack()
myLabel = tk.Label(text=f"{r.get()}").pack()

root.mainloop()


# # Message Boxes
# 
Ejemplo n.º 18
0
    def __init__(self, pController):
        self.started = False
        self.main = tk.Tk()
        self.main.title("Gw2 Alarm")
        self.main.geometry("495x495+0+0")
        self.main.resizable(False, False)
        self.main.configure(background="#383a39")
        self.main.iconbitmap("Images/icon.ico")
        self.controller = pController
        self.itemUIP = [] #Liste der Items
        self.imgGold = tk.PhotoImage(file = "Images/Gold_coin.png")
        self.imgSilber = tk.PhotoImage(file = "Images/Silver_coin.png")
        self.imgBronze = tk.PhotoImage(file = "Images/Copper_coin.png")
        self.v = tk.IntVar() #Buy/Sell Order
        self.g = tk.IntVar() #Operator
        self.a = tk.IntVar() #Annzahl der Alarme
        self.b = tk.StringVar() #Anzeige Text beim Auswählen eines Items
        self.u = tk.StringVar() #Updatetimer
        self.d = tk.StringVar() #Dauer der Win10 Notification

        self.title = tk.Label(self.main, text = "GW2 P E P E G A ", font = ("Verdanan", 21, "bold"), bg="#1c1d1c", fg="#EEE9E9",
                               activeforeground = "#ce480f", activebackground = "#1c1d1c", relief = "flat", bd = 0)
        self.title.place(x = 0, y = 0)

        self.ladenButton = tk.Button(self.main, text = "Laden", font = ("Verdanan", 11, "bold"), bg="#1c1d1c", fg="#EEE9E9",
                                      activeforeground = "#ce480f", activebackground = "#1c1d1c", relief = "flat", bd = 0, state = "normal",
                                      disabledforeground= "#494a49", command = self.laden)
        self.ladenButton.place(x = 0, y = 35)

        self.tpItem = tk.Listbox(self.main, bg = "#1c1d1c", font = ("Verdanan", 10, "bold"), bd = 0, highlightthickness = 0, selectbackground = "#ce480f", fg = "white")
        self.tpItem.place(x = 0, y = 60)

        self.tpButton = tk.Button(self.main, text = "Item hinzufügen", font = ("Verdanan", 10, "bold"), bg="#1c1d1c", fg="#EEE9E9",
                                   activeforeground = "#ce480f", activebackground = "#1c1d1c", relief = "flat", bd = 0, state = "normal",
                                   disabledforeground= "#494a49", command = self.addItem)
        self.tpButton.place(x = 140, y = 60)

        self.tpRemove = tk.Button(self.main, text = "Item löschen", font = ("Verdanan", 10, "bold"), bg="#1c1d1c", fg="#EEE9E9",
                                   activeforeground = "#ce480f", activebackground = "#1c1d1c", relief = "flat", bd = 0, state = "normal",
                                   disabledforeground= "#494a49", command = self.removeItem)
        self.tpRemove.place(x = 353, y = 60)


        self.tpEntry = tk.Entry(self.main, bg = "#1c1d1c", fg = "#EEE9E9", width = 50, bd = 0, state = "normal", disabledbackground = "#494a49", disabledforeground= "#EEE9E9")
        self.tpEntry.place(x = 140, y = 85)

        self.goldEntry = tk.Entry(self.main, bg="#1c1d1c", fg="#EEE9E9", width=4, bd=0, state="normal", disabledbackground="#494a49", disabledforeground="#EEE9E9")
        self.goldEntry.place(x = 140, y = 102)

        self.goldT = tk.Label(self.main, image = self.imgGold, bg = "#383a39")
        self.goldT.place(x = 167, y = 102)

        self.silberEntry = tk.Entry(self.main, bg="#1c1d1c", fg="#EEE9E9", width=4, bd=0, state="normal", disabledbackground="#494a49", disabledforeground="#EEE9E9")
        self.silberEntry.place(x = 190, y = 102)

        self.silberT = tk.Label(self.main, image = self.imgSilber, bg = "#383a39")
        self.silberT.place(x = 217, y = 102)

        self.bronzeEntry = tk.Entry(self.main, bg="#1c1d1c", fg="#EEE9E9", width=4, bd=0, state="normal", disabledbackground="#494a49", disabledforeground="#EEE9E9")
        self.bronzeEntry.place(x = 240, y = 102)

        self.bronzeT = tk.Label(self.main, image = self.imgBronze, bg = "#383a39")
        self.bronzeT.place(x = 267, y = 102)

        self.buyRadio = tk.Radiobutton(self.main, text = "Buy order", variable = self.v, value = 1, bg = "#383a39", fg = "#EEE9E9",
                                        activebackground = "#383a39", activeforeground = "#EEE9E9", selectcolor = "#1c1d1c", state = "normal")
        self.buyRadio.place(x = 140, y = 120)

        self.sellRadio = tk.Radiobutton(self.main, text = "Sell order", variable = self.v, value = 2, bg = "#383a39", fg = "#EEE9E9",
                                         activebackground = "#383a39", activeforeground = "#EEE9E9", selectcolor = "#1c1d1c", state = "normal")
        self.sellRadio.place(x = 140, y = 138)

        self.boxInfo = tk.Label(self.main, textvariable = self.b, font = ("Verdanan", 10, "bold"), bg="#383a39", fg="#EEE9E9")
        self.boxInfo.place(x =  140, y = 200)

        self.updateOption = ttk.Combobox(self.main, textvariable = self.u, state = "normal")
        self.updateOption.place(x = 0, y = 233)
        self.updateOption.bind("<Key>", lambda e: "break")

        self.delayOption = ttk.Combobox(self.main, textvariable = self.d, state = "normal")
        self.delayOption.place(x = 0, y = 293)
        self.delayOption.bind("<Key>", lambda e: "break")
        self.delayOption.bind("<<ComboboxSelected>>", self.setDelay)

        self.updateLabel = tk.Label(self.main, text = "Wie oft soll geupdated \nwerden?", font = ("Verdanan", 9, "bold"), bg="#383a39", fg="#EEE9E9")
        self.updateLabel.place(x = 0, y = 255)

        self.delayLabel = tk.Label(self.main, text = "Wie lange \nsollen Benachrichtungen \nangezeigt werden?", font = ("Verdanan", 9, "bold"), bg="#383a39", fg="#EEE9E9")
        self.delayLabel.place(x = 0, y = 315)

        self.saveButton = tk.Button(self.main, text = "Speichern", font = ("Verdanan", 10, "bold"), bg="#1c1d1c", fg="#EEE9E9",
                                     activeforeground = "#ce480f", activebackground = "#1c1d1c", relief = "flat", bd = 0, state = "normal",
                                     disabledforeground= "#494a49", command = self.saveItem)
        self.saveButton.place(x = 368, y = 104)

        self.biggerRadio = tk.Radiobutton(self.main, text = "TP Preis größer", variable = self.g, value = 1, bg = "#383a39", fg = "#EEE9E9",
                                           activebackground = "#383a39", activeforeground = "#EEE9E9", selectcolor = "#1c1d1c", state = "normal")
        self.biggerRadio.place(x = 220, y = 120)

        self.smallerRadio = tk.Radiobutton(self.main, text = "TP Preis kleiner", variable = self.g, value = 2, bg = "#383a39", fg = "#EEE9E9",
                                            activebackground = "#383a39", activeforeground = "#EEE9E9", selectcolor = "#1c1d1c", state = "normal")
        self.smallerRadio.place(x = 220, y = 138)

        self.einmaligRadio = tk.Radiobutton(self.main, text = "Einmaliger Alarm", variable = self.a, value = 1, bg = "#383a39", fg = "#EEE9E9",
                                           activebackground = "#383a39", activeforeground = "#EEE9E9", selectcolor = "#1c1d1c", state = "normal")
        self.einmaligRadio.place(x = 140, y = 160)

        self.mehrRadio = tk.Radiobutton(self.main, text = "Mehrmaliger Alarm", variable = self.a, value = 2, bg = "#383a39", fg = "#EEE9E9",
                                            activebackground = "#383a39", activeforeground = "#EEE9E9", selectcolor = "#1c1d1c", state = "normal")
        self.mehrRadio.place(x = 140, y = 178)

        self.reaktButton = tk.Button(self.main, text = "Reaktivieren", font = ("Verdanan", 9, "bold"), bg="#1c1d1c", fg="#EEE9E9",
                                     activeforeground = "#ce480f", activebackground = "#1c1d1c", relief = "flat", bd = 0, state = "normal",
                                     disabledforeground= "#494a49", command = self.reaktivierenItem)
        self.reaktButton.place(x = 270, y = 162)

        self.main.bind("<Return>", self.addItem)

        self.priceUpdate(0)
        self.startGUI()
                    sheet.row_dimensions[idx].hidden = True

            wb.save(window.directory + '/' + outputName.get() + '.xlsx')

    else:
        tkinter.Label(window, text="Select a file!", justify=tkinter.CENTER, padx=20, font=12).place(x=185, y=500)

# ____________TKINTER BUTTONS_____________ #

tkinter.Label(window, text="\nANONYMISED Spreadsheet Manager\n\n", justify=tkinter.CENTER, padx=20
              , font=16).pack(side=tkinter.TOP)

tkinter.Label(window, text="Select a spreadsheet type:", justify=tkinter.CENTER, padx=20, font=12).pack(side=tkinter.TOP)

for val, spreadsheet in enumerate(spreadsheets):
    tkinter.Radiobutton(window, text=spreadsheet[0], indicatoron=1, width=20, padx=20, variable=buttonVal, command=showChoice
                        , value=val, font=12).pack(side=tkinter.TOP)

file = tkinter.Button(window, text='Open File', width=25, command=showChoice2, font=12).place(x=200, y=200)

tkinter.Label(window, text='Output file name: ', font=20).place(x=20, y=320)

outputName = tkinter.StringVar()

entry = tkinter.Entry(window, textvariable=outputName, width=25, bd=2, font=22).place(x=200, y=320)

directoryButton = tkinter.Button(window, text='Output Folder', width=25, command=output2, font=12).place(x=200, y=370)

createButton = tkinter.Button(window, text='Create', width=25, command=create, font=12).place(x=200, y=475)

exitButton = tkinter.Button(window, text='Exit', width=25, command=window.destroy, font=12).place(x=350, y=550)
Ejemplo n.º 20
0
    def _create_widgets(self):
        """ Creates the widgets for the nav bar """

        # label - description of popup
        self.label_title = tk.Label(self._parent,
                                    text="Please fulfill these entries",
                                    width=20,
                                    font=("bold, 11"))
        self.label_title.place(x=150, y=10)

        # label - timestamp
        self.timestamp_label = tk.Label(self._parent,
                                        text="Timestamp :",
                                        width=20)
        self.timestamp_label.place(x=10, y=50)
        # entry - timestamp
        self.timestamp_entry = tk.Entry(self._parent)
        self.timestamp_entry.place(x=150, y=50)
        # label - example of timestamp
        self.timestamp_eg = tk.Label(self._parent,
                                     text="eg) 2018-12-01 19:10",
                                     width=20)
        self.timestamp_eg.place(x=300, y=50)

        # label2 - model
        self.model_label = tk.Label(self._parent,
                                    text="Sensor Model :",
                                    width=20)
        self.model_label.place(x=10, y=100)
        # entry - model
        self.model_entry = tk.Entry(self._parent)
        self.model_entry.place(x=150, y=100)
        # label - example of model
        self.model_eg = tk.Label(self._parent,
                                 text="eg) ABC Sensor Temp M301A",
                                 width=25)
        self.model_eg.place(x=305, y=100)

        # label3 - min_reading
        self.min_label = tk.Label(self._parent, text="Min Reading :", width=20)
        self.min_label.place(x=10, y=150)
        # entry - min_reading
        self.min_entry = tk.Entry(self._parent)
        self.min_entry.place(x=150, y=150)
        # label - example of min_reading
        self.min_eg = tk.Label(self._parent, text="eg) 20.152", width=20)
        self.min_eg.place(x=272, y=150)

        # label4 - avg_reading
        self.avg_label = tk.Label(self._parent, text="Avg Reading :", width=20)
        self.avg_label.place(x=10, y=200)
        # entry - avg_reading
        self.avg_entry = tk.Entry(self._parent)
        self.avg_entry.place(x=150, y=200)
        # label - example of avg_reading
        self.avg_label = tk.Label(self._parent, text="eg) 21.367", width=20)
        self.avg_label.place(x=272, y=200)

        # label5 - max_reading
        self.max_label = tk.Label(self._parent, text="Max Reading :", width=20)
        self.max_label.place(x=10, y=250)
        # entry - avg_reading
        self.max_entry = tk.Entry(self._parent)
        self.max_entry.place(x=150, y=250)
        # label - example of avg_reading
        self.max_eg = tk.Label(self._parent, text="eg) 22.005", width=20)
        self.max_eg.place(x=272, y=250)

        self.status_label = tk.Label(self._parent,
                                     text="Choose Status:",
                                     width=20).place(x=10, y=300)

        self.radio_ok = tk.Radiobutton(self._parent,
                                       text="OK",
                                       value="OK",
                                       variable=self._status_var).place(x=150,
                                                                        y=300)

        self.radio_high = tk.Radiobutton(self._parent,
                                         text="HIGH",
                                         value="HIGH",
                                         variable=self._status_var).place(
                                             x=250, y=300)

        self.radio_low = tk.Radiobutton(self._parent,
                                        text="LOW",
                                        value="LOW",
                                        variable=self._status_var).place(x=350,
                                                                         y=300)

        self._submit_button = tk.Button(self._parent,
                                        text="Submit",
                                        command=self.add_reading)
        self._submit_button.place(x=100, y=350)

        self._close_button = tk.Button(self._parent,
                                       text="Close",
                                       command=self._close_popup_callback)

        self._close_button.place(x=200, y=350)
Ejemplo n.º 21
0
#add a scroll bar
listScroll = tkinter.Scrollbar(mainWindow,
                               orient=tkinter.VERTICAL,
                               command=fileList.yview)
listScroll.grid(row=1, column=1, sticky='nsw', rowspan=2)
fileList['yscrollcommand'] = listScroll.set

#frame for the radio buttons
optionFrame = tkinter.LabelFrame(mainWindow, text="File Details")
optionFrame.grid(row=1, column=2, sticky='ne')

rbValue = tkinter.IntVar()
rbValue.set(1)
#Radio buttons
radio1 = tkinter.Radiobutton(optionFrame,
                             text="Filename",
                             value=1,
                             variable=rbValue)
radio2 = tkinter.Radiobutton(optionFrame,
                             text="Path",
                             value=2,
                             variable=rbValue)
radio3 = tkinter.Radiobutton(optionFrame,
                             text="Timestamp",
                             value=3,
                             variable=rbValue)
radio1.grid(row=0, column=0, sticky='w')
radio2.grid(row=1, column=0, sticky='w')
radio3.grid(row=2, column=0, sticky='w')

#widget to display the result
resultLabel = tkinter.Label(mainWindow, text="Result")
Ejemplo n.º 22
0
    def init_meta(self):
        self.meta_frame = self.add_tab(self.notebook, "Metadata", 0)

        self.info_labelframe = tk.LabelFrame(self.meta_frame, text="Info")
        self.info_labelframe.grid(row=0, column=0, sticky="NWSE")

        self.title_label = tk.Label(self.info_labelframe, text="Title")
        self.title_label.grid(row=0, column=0, sticky="NWSE")
        self.title_text = tk.Text(self.info_labelframe, wrap=tk.WORD, height=1, width=51)
        self.title_text.grid(row=0, column=1, sticky="NWSE")

        self.description_label = tk.Label(self.info_labelframe, text="Description")
        self.description_label.grid(row=1, column=0, sticky="NWSE")
        self.description_text = tk.Text(self.info_labelframe, wrap=tk.WORD, spacing3=2, height=2, width=47)
        self.description_text.grid(row=1, column=1, sticky="NWSE")

        self.mission_labelframe = tk.LabelFrame(self.meta_frame, text="Mission")
        self.mission_labelframe.grid(row=1, column=0, sticky="NWSE")

        self.mission_text = tk.Text(self.mission_labelframe, wrap=tk.WORD, spacing3=2, height=8, width=78)
        self.mission_text.grid(row=0, column=0, sticky="NWSE")

        self.grid_coords_labelframe = tk.LabelFrame(self.meta_frame, text="Grid coordinates")
        self.grid_coords_labelframe.grid(row=2, column=0, sticky="NWSE")

        self.grid_coords_var = tk.IntVar()
        self.grid_coords_var.set(int(self.level_data["grid_coords"]))
        self.grid_coords_labelframe.grid_columnconfigure(0, uniform="grid_coords_labelframe")
        self.grid_coords_labelframe.grid_columnconfigure(1, uniform="grid_coords_labelframe")
        self.grid_coords_hidden = tk.Radiobutton(self.grid_coords_labelframe, text="Hidden", variable=self.grid_coords_var, value=int(False), command=self.toggle_grid_coords)
        self.grid_coords_shown = tk.Radiobutton(self.grid_coords_labelframe, text="Shown", variable=self.grid_coords_var, value=int(True), command=self.toggle_grid_coords)

        self.grid_coords_hidden.grid(row=0, column=0, sticky="NWSE")
        self.grid_coords_shown.grid(row=0, column=1, sticky="NWSE")

        self.limitations_labelframe = tk.LabelFrame(self.meta_frame, text="Limitations")
        self.limitations_labelframe.grid(row=3, column=0, sticky="NWSE")

        self.stack_size_label = tk.Label(self.limitations_labelframe, text="Stack size")
        self.stack_size_label.grid(row=0, column=0, sticky="NWSE")
        self.stack_allowed_var = tk.IntVar()
        self.stack_allowed_var.set(int(False))
        self.stack_allowed_checkbutton = tk.Checkbutton(self.limitations_labelframe, text="Allow stack", onvalue=int(True), offvalue=int(False), var=self.stack_allowed_var, command=self.toggle_stack_allowed)
        self.stack_allowed_checkbutton.grid(row=0, column=1, sticky="NWSE")
        self.stack_size_var = tk.StringVar()
        self.stack_size_spinbox = tk.Spinbox(self.limitations_labelframe, from_=MIN_STACK_SIZE, to=MAX_STACK_SIZE, textvariable=self.stack_size_var, state=tk.DISABLED, justify=tk.RIGHT)
        self.stack_size_spinbox.grid(row=0, column=2, sticky="NWSE")

        self.memory_size_label = tk.Label(self.limitations_labelframe, text="Memory size")
        self.memory_size_label.grid(row=1, column=0, sticky="NWSE")
        self.memory_allowed_var = tk.IntVar()
        self.memory_allowed_var.set(int(False))
        self.memory_allowed_checkbutton = tk.Checkbutton(self.limitations_labelframe, text="Allow memory", onvalue=int(True), offvalue=int(False), var=self.memory_allowed_var, command=self.toggle_memory_allowed)
        self.memory_allowed_checkbutton.grid(row=1, column=1, sticky="NWSE")
        self.memory_size_var = tk.StringVar()
        self.memory_size_spinbox = tk.Spinbox(self.limitations_labelframe, from_=MIN_MEMORY_SIZE, to=MAX_MEMORY_SIZE, textvariable=self.memory_size_var, state=tk.DISABLED, justify=tk.RIGHT)
        self.memory_size_spinbox.grid(row=1, column=2, sticky="NWSE")

        self.subprograms_count_label = tk.Label(self.limitations_labelframe, text="Subprograms")
        self.subprograms_count_label.grid(row=2, column=0, sticky="NWSE")
        self.subprograms_allowed_var = tk.IntVar()
        self.subprograms_allowed_var.set(int(False))
        self.subprograms_allowed_checkbutton = tk.Checkbutton(self.limitations_labelframe, text="Allow subprograms", onvalue=int(True), offvalue=int(False), var=self.subprograms_allowed_var, command=self.toggle_subprograms_allowed)
        self.subprograms_allowed_checkbutton.grid(row=2, column=1, sticky="NWSE")
        self.subprograms_count_var = tk.StringVar()
        self.subprograms_count_spinbox = tk.Spinbox(self.limitations_labelframe, from_=MIN_SUBPROGRAMS, to=MAX_SUBPROGRAMS, textvariable=self.subprograms_count_var, state=tk.DISABLED, justify=tk.RIGHT)
        self.subprograms_count_spinbox.grid(row=2, column=2, sticky="NWSE")

        self.banned_commands = tk.Label(self.limitations_labelframe, text="Banned commands")
        self.banned_commands.grid(row=3, rowspan=2, column=0, sticky="NWSE")
        self.banned_commands_text = tk.Text(self.limitations_labelframe, wrap=tk.WORD, spacing3=2, height=4, width=64)
        self.banned_commands_text.grid(row=3, rowspan=2, column=1, columnspan=2, sticky="NWSE")
Ejemplo n.º 23
0
def open_indication_window():
    global var
    global indication_var
    indic_window = Toplevel(window)
    indic_window.title("Select current anticoagulant and indication")
    ac = ttk.Label(indic_window,
                   text="ANTIACOAGULANT? ",
                   font=('', 20, 'bold')).grid(column=0, row=6)
    var = tk.StringVar()
    for a in range(len(anticoagulant)):
        tk.Radiobutton(indic_window,
                       text=anticoagulant[a],
                       font=('', 20, 'bold'),
                       indicatoron=0,
                       variable=var,
                       value=anticoagulant[a],
                       bg='navajo white').grid(row=(a + 7),
                                               column=0,
                                               padx=5,
                                               pady=5,
                                               sticky=(N, S, E, W))

    indic_label = ttk.Label(indic_window,
                            text='INDICATION?',
                            font=('', 20, 'bold')).grid(column=0, row=10)
    indication_var = tk.StringVar()
    tk.Radiobutton(indic_window,
                   text="Venous Thromboembolism",
                   font=('', 20, 'bold'),
                   indicatoron=0,
                   variable=indication_var,
                   value='VTE',
                   command=open_vte_window,
                   bg='navajo white').grid(row=13,
                                           column=0,
                                           padx=5,
                                           pady=5,
                                           sticky=(N, S, E, W))
    tk.Radiobutton(indic_window,
                   text="Atrial Fibrillation",
                   font=('', 20, 'bold'),
                   indicatoron=0,
                   variable=indication_var,
                   value='AF',
                   command=open_afib_window,
                   bg='navajo white').grid(row=14,
                                           column=0,
                                           padx=5,
                                           pady=5,
                                           sticky=(N, S, E, W))
    tk.Radiobutton(indic_window,
                   text="Mechanical Heart Valve",
                   font=('', 20, 'bold'),
                   indicatoron=0,
                   variable=indication_var,
                   value='MECH',
                   command=open_mech_window,
                   bg='navajo white').grid(row=15,
                                           column=0,
                                           padx=5,
                                           pady=5,
                                           sticky=(N, S, E, W))
Ejemplo n.º 24
0
    def init_tests(self):
        self.tests = []

        self.tests_frame = self.add_tab(self.notebook, "Tests", 0)
        self.tests_list_frame = tk.Frame(self.tests_frame)
        self.tests_list_frame.grid(row=0, column=0, sticky="NWSE")

        self.tests_list = tk.Listbox(self.tests_list_frame, width=len("Test XXX"), height=MAX_TESTS, selectmode=tk.SINGLE)
        self.tests_list.grid(row=1, column=0, columnspan=2, sticky="NWSE")
        self.tests_list.bind("<<ListboxSelect>>", self.select_test)
        self.tests_list.bind("<Double-Button-1>", self.select_test)

        self.add_test_button = tk.Button(self.tests_list_frame, text="Add test", command=self.add_test)
        self.add_test_button.grid(row=0, column=0, sticky="NWSE")
        self.delete_test_button = tk.Button(self.tests_list_frame, text="Delete last test", command=self.remove_test)
        self.delete_test_button.grid(row=0, column=1, sticky="NWSE")

        self.tests_display_frame = tk.Frame(self.tests_frame)
        self.tests_display_frame.grid(row=0, column=1, sticky="NWSE")

        self.test_meta_frame = tk.Frame(self.tests_display_frame)
        self.test_meta_frame.grid(row=0, column=0, columnspan=len(SQUARE_TYPES)+1, sticky="NWSE")
        self.test_width_var = tk.StringVar()
        self.test_height_var = tk.StringVar()
        self.test_spawn_column_var = tk.StringVar()
        self.test_spawn_row_var = tk.StringVar()

        self.test_width_label = tk.Label(self.test_meta_frame, text="Test width")
        self.test_width_label.grid(row=0, column=0, columnspan=2, sticky="NWSE")
        self.test_width_spinbox = tk.Spinbox(self.test_meta_frame, from_=1, to=MAX_GRID_SIZE, textvariable=self.test_width_var, width=3, command=self.set_test_width, justify=tk.RIGHT)
        self.test_width_spinbox.grid(row=0, column=2, columnspan=2, sticky="NWSE")

        self.test_height_label = tk.Label(self.test_meta_frame, text="Test height")
        self.test_height_label.grid(row=0, column=4, columnspan=2, sticky="NWSE")
        self.test_height_spinbox = tk.Spinbox(self.test_meta_frame, from_=1, to=MAX_GRID_SIZE, textvariable=self.test_height_var, width=3, command=self.set_test_height, justify=tk.RIGHT)
        self.test_height_spinbox.grid(row=0, column=6, columnspan=2, sticky="NWSE")

        self.test_spawn_column_label = tk.Label(self.test_meta_frame, text="Spawn column")
        self.test_spawn_column_label.grid(row=0, column=8, columnspan=2, sticky="NWSE")
        self.test_spawn_column_spinbox = tk.Spinbox(self.test_meta_frame, from_=1, to=MAX_GRID_SIZE, textvariable=self.test_spawn_column_var, width=3, command=self.set_test_spawn_column, justify=tk.RIGHT)
        self.test_spawn_column_spinbox.grid(row=0, column=10, columnspan=2, sticky="NWSE")

        self.test_spawn_row_label = tk.Label(self.test_meta_frame, text="Spawn row")
        self.test_spawn_row_label.grid(row=0, column=12, columnspan=2, sticky="NWSE")
        self.test_spawn_row_spinbox = tk.Spinbox(self.test_meta_frame, from_=1, to=MAX_GRID_SIZE, textvariable=self.test_spawn_row_var, width=3, command=self.set_test_spawn_row, justify=tk.RIGHT)
        self.test_spawn_row_spinbox.grid(row=0, column=14, columnspan=2, sticky="NWSE")

        self.selected_square_type_var = tk.IntVar()
        self.selected_square_type = 0
        self.selected_square_type_var.set(self.selected_square_type)

        self.selected_square_frames = []
        self.selected_square_labels = []
        self.selected_square_radios = []

        for i, square_type in enumerate(SQUARE_TYPES):
            self.selected_square_frames.append(tk.Frame(self.tests_display_frame))
            self.selected_square_labels.append(tk.Label(self.selected_square_frames[-1], image=images[square_type]))
            self.selected_square_radios.append(tk.Radiobutton(self.selected_square_frames[-1], variable=self.selected_square_type_var, value=i, command=self.editor_selector_handler_radio))

            self.selected_square_frames[-1].grid(row=1, column=i, sticky="NWSE")

            def handler(event, self=self, i=i):
                return self.editor_selector_handler_label(i)

            self.selected_square_labels[-1].bind("<Button-1>", handler)
            self.selected_square_labels[-1].grid(row=0, column=0, sticky="NWSE")
            self.selected_square_radios[-1].grid(row=1, column=0, sticky="NWSE")

        self.square_number_value_var = tk.StringVar()
        self.square_number_value_var.set("0")

        self.selected_square_frames.append(tk.Frame(self.tests_display_frame))
        self.selected_square_labels.append(tk.Spinbox(self.selected_square_frames[-1], from_=-99, to=99, textvariable=self.square_number_value_var, width=3, command=lambda: self.editor_selector_handler_label(len(SQUARE_TYPES)), justify=tk.RIGHT))
        self.selected_square_radios.append(tk.Radiobutton(self.selected_square_frames[-1], variable=self.selected_square_type_var, value=len(SQUARE_TYPES), command=self.editor_selector_handler_radio))

        self.selected_square_frames[-1].grid(row=1, column=len(SQUARE_TYPES), sticky="NWSE")
        self.selected_square_labels[-1].bind("<Button-1>", lambda ev: self.editor_selector_handler_label(len(SQUARE_TYPES)))
        self.selected_square_labels[-1].grid(row=0, column=0, sticky="NWSE")
        self.selected_square_radios[-1].grid(row=1, column=0, sticky="NWSE")

        self.tests_notebook = ttk.Notebook(self.tests_display_frame)
        self.tests_notebook.grid(row=2, column=0, columnspan=len(SQUARE_TYPES)+1, sticky="NWSE")

        self.tests_start_frame = self.add_tab(self.tests_notebook, "Start")
        self.tests_wanted_frame = self.add_tab(self.tests_notebook, "Wanted")

        self.tests_canvas_start = tk.Canvas(self.tests_start_frame, width=MAX_GRID_SIZE*PIXELS_PER_SQUARE, height=MAX_GRID_SIZE*PIXELS_PER_SQUARE)
        self.tests_canvas_start.grid(row=1, column=0, sticky="NWSE")
        self.tests_canvas_start.create_image(0,0, anchor=tk.NW, image=images["robot"], tags="robot")
        self.tests_canvas_start.bind("<Button-1>", self.editor_start_handler)

        self.tests_canvas_wanted = tk.Canvas(self.tests_wanted_frame, width=MAX_GRID_SIZE*PIXELS_PER_SQUARE, height=MAX_GRID_SIZE*PIXELS_PER_SQUARE)
        self.tests_canvas_wanted.grid(row=1, sticky="NWSE")
        self.tests_canvas_wanted.bind("<Button-1>", self.editor_wanted_handler)
Ejemplo n.º 25
0
def App_CoolingWarming(DataLoc, MachineType):
    global canvas

    #controls the window for cooling and warming
    rootCW = tk.Toplevel()
    rootCW.title('PPMV Cooling and Warming')
    rootCW.iconbitmap('QMC_Temp.ico')

    ####Header widget
    Header_L = tk.Label(rootCW, text='PPMV Cooling and Warming')
    Header_L.grid(row=0, column=0, pady=(0, 10))

    ####Load Frame
    LoadFrame = tk.LabelFrame(rootCW, text='Check/Change Loaded Data')
    LoadFrame.grid(row=1, column=0, padx=10, sticky=tk.W)
    #LoadFrame.grid_configure(ipadx=300)

    #show load buttons and import load from the previous window
    #load data widgets
    Load_B = tk.Button(LoadFrame,
                       text="Load data",
                       command=launcher.Button_LoadData)
    Load_B.grid(row=0, column=0)

    Load_check_L = tk.Label(LoadFrame, text='File:')
    Load_check_L.grid(row=0, column=1, padx=(20, 0))

    Load_check_E = tk.Entry(LoadFrame)
    Load_check_E.grid(row=0, column=2)
    #start with DataLoc from launcher
    Load_check_E.insert(0, DataLoc)

    #machine selection for data
    Machine = tk.StringVar()
    Machine.set(MachineType)

    Load_machine_L = tk.Label(LoadFrame, text='PPMS and Puck Used:')
    Load_machine_L.grid(row=0, column=3, padx=(20, 0))

    Load_machine_D = tk.OptionMenu(LoadFrame, Machine, '9T-ACT', '9T-R',
                                   '14T-ACT', '14T-R', 'Dynacool')
    Load_machine_D.grid(row=0, column=4)

    ####Plotting
    #create plot and put on screen. Have it empty to start
    #make plot
    fig, CWPlot = ppmv.Job_CWPlot(empty=True)
    #set plot to screen
    canvas = FigureCanvasTkAgg(fig, master=rootCW)
    canvas.draw()
    canvas.get_tk_widget().grid(row=2, column=1, columnspan=2)

    #set toolbar and post to window
    toolbarFrame = tk.Frame(rootCW)
    toolbarFrame.grid(row=3, column=1, columnspan=2)
    toolbar = NavigationToolbar2Tk(canvas, toolbarFrame)

    #create save button for plot
    SaveFig_B = tk.Button(rootCW, text='Save Figure')
    SaveFig_B.grid(row=4, column=1)

    #create export CVS button
    Export_B = tk.Button(rootCW, text='Save Seperate CSVs')
    Export_B.grid(row=4, column=2)

    ####Cooling and Warming Settings Frame
    SetFrame = tk.LabelFrame(rootCW, text='Settings')
    SetFrame.grid(row=2, column=0)

    #1st direction: pick axes
    help1 = 'Seperate your data into Cooling and Warming curves\nChoose your x and y axis to split up'
    Direction1 = tk.Label(SetFrame, text=help1)
    Direction1.grid(row=0, column=0, columnspan=2)

    #x and y axis drop down menu selection
    Xchoice = tk.StringVar()
    Ychoice = tk.StringVar()

    #set each as the usualy starting ones
    Xchoice.set('Temperature (K)')
    Ychoice.set('Bridge1_R (ohms)')

    #make menus
    QuickP_Xchoice_L = tk.Label(SetFrame, text='x axis')
    QuickP_Xchoice_L.grid(row=1, column=0)

    QuickP_Ychoice_L = tk.Label(SetFrame, text='y axis')
    QuickP_Ychoice_L.grid(row=2, column=0, pady=(0, 5))

    QuickP_Xchoice_D = tk.OptionMenu(SetFrame, Xchoice, 'Temperature (K)',
                                     'Field (Oe)')
    QuickP_Xchoice_D.grid(row=1, column=1)
    QuickP_Ychoice_D = tk.OptionMenu(SetFrame, Ychoice, 'Bridge1_R (ohms)',
                                     'Bridge2_R (ohms)', 'Bridge3_R (ohms)')
    QuickP_Ychoice_D.grid(row=2, column=1, pady=(0, 5))

    #Cooling and Warming radio buttons toggle
    Radio_L = tk.Label(SetFrame, text='Cooling/Warming toggle')
    Radio_L.grid(row=3, column=0, rowspan=2)

    #test label
    v = tk.BooleanVar()
    v.set(False)
    RadioTest = tk.Label(SetFrame, text=str(v.get()))
    RadioTest.grid(row=5, column=0)

    RadioOff = tk.Radiobutton(
        SetFrame,
        text='off',
        variable=v,
        value=False,
        command=lambda: Click_Radio(SetFrame, str(v.get()), RadioTest))
    RadioOff.grid(row=3, column=1, sticky=tk.W)

    RadioOn = tk.Radiobutton(
        SetFrame,
        text='on',
        variable=v,
        value=True,
        command=lambda: Click_Radio(SetFrame, str(v.get()), RadioTest))
    RadioOn.grid(row=4, column=1, sticky=tk.W)

    ####Update Buttons
    #make update button for plot below settings settings
    #Update_Bset=tk.Button(rootCW,text='Update Plot',command=lambda:Update_ButtonPlot(root,X1=np.NaN,Y1=np.NaN,X2=np.NaN,Y2=np.NaN) )
    #Update_Bset.grid(row=3,column=0)

    #make update button for plot
    Update_B = tk.Button(
        rootCW,
        text='Update Plot',
        command=lambda: Update_ButtonPlot(Load_check_E.get(), Machine.get(
        ), Xchoice.get(), Ychoice.get(), v.get(), canvas, rootCW))
    Update_B.grid(row=3, column=2, sticky=tk.E)
Ejemplo n.º 26
0
                             text="love",
                             variable=hobby3,
                             command=updateData)
check4 = tkinter.Checkbutton(win,
                             text="power",
                             variable=hobby4,
                             command=updateData)
check1.pack()
check2.pack()
check3.pack()
check4.pack()

r = tkinter.IntVar()
radio = tkinter.Radiobutton(win,
                            text="one",
                            value=1,
                            variable=r,
                            command=printRadioValue)
radio.pack()
radio1 = tkinter.Radiobutton(win,
                             text="one",
                             value=2,
                             variable=r,
                             command=printRadioValue)
radio1.pack()

listbox = tkinter.Listbox(win, selectmode=tkinter.BROWSE)
listbox.pack()
for item in ["good", "nice", "handsome"]:
    listbox.insert(tkinter.END, item)
                               textvariable=max_hours_default,
                               justify="center",
                               font=(font_body, font_body_size),
                               relief="solid")
max_hours_default.set("24")
# Label for setting preferred search type (min days first or min campus hours)
search_type_label = tk.Label(window,
                             text="Preferred:",
                             font=(font_body, font_body_size))
# Radio buttons
# If this variable is 0, minimize days otherwise minimize campus hours
search_type = tk.IntVar()
search_type.set(0)
search_type_days = tk.Radiobutton(window,
                                  text="Minimize days",
                                  padx=20,
                                  variable=search_type,
                                  value=0,
                                  font=(font_body, font_body_size))
search_type_hours = tk.Radiobutton(window,
                                   text="Minimize campus hours",
                                   padx=20,
                                   variable=search_type,
                                   value=1,
                                   font=(font_body, font_body_size))

# Label for skipped lecture types
skip_types_label = tk.Label(window,
                            text="Ignore these class types:",
                            font=(font_body, font_body_size))
# Entry field for entering skipped types
skip_types_textbox = tk.Entry(window,
Ejemplo n.º 28
0
textBox.config(yscrollcommand=scroll.set)

# frame2: tab view, radio button, button, result(labelframe), plot

tabs = ttk.Notebook(frame2, width=540, height=300)
tabs.place(x=25, y=25)

tab1 = ttk.Frame(tabs, width=50, height=50)
tab2 = ttk.Frame(tabs)

tabs.add(tab1, text="Line")
tabs.add(tab2, text="Scatter", compound=tk.LEFT)

# radio button
method = tk.StringVar()
tk.Radiobutton(frame2, text="m1: ", value="m1", variable=method).place(x=580,
                                                                       y=100)
tk.Radiobutton(frame2, text="m2: ", value="m2", variable=method).place(x=580,
                                                                       y=125)

# label frame: result
label_frame = tk.LabelFrame(frame2, text="Result", width=100, height=150)
label_frame.place(x=580, y=25)
tk.Label(label_frame, text="Buy: ", bd=3).grid(row=0, column=0)
tk.Label(label_frame, text="Sell: ", bd=3).grid(row=1, column=0)

# buy sell labels
buy_value = tk.Label(label_frame, text="1", bd=3)
buy_value.grid(row=0, column=1)
sell_value = tk.Label(label_frame, text="0", bd=3)
sell_value.grid(row=1, column=1)
Ejemplo n.º 29
0
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9'  # X11 color: 'gray85'
        _ana1color = '#d9d9d9'  # X11 color: 'gray85'
        _ana2color = '#ececec'  # Closest X11 color: 'gray92'
        font12 = "-family {Segoe UI} -size 10 -weight bold -slant " \
                 "roman -underline 0 -overstrike 0"

        top.geometry("750x700+252+59")
        top.title("Order Updater")
        top.configure(background="#d9d9d9")

        self.Frame1 = tk.Frame(top)
        self.Frame1.place(relx=0.02, rely=0.04, relheight=0.95, relwidth=0.95)

        self.Frame1.configure(relief='groove')
        self.Frame1.configure(borderwidth="2")
        self.Frame1.configure(relief='groove')
        self.Frame1.configure(background="#d9d9d9")
        self.Frame1.configure(width=715)

        # self.restartall = tk.Button(self.Frame1)
        # self.restartall.place(relx=0.643, rely=0.063, height=44, width=94)
        # self.restartall.configure(activebackground="#ececec")
        # self.restartall.configure(activeforeground="#000000")
        # self.restartall.configure(background="#1dd609")
        # self.restartall.configure(disabledforeground="#a3a3a3")
        # self.restartall.configure(foreground="#000000")
        # self.restartall.configure(highlightbackground="#d9d9d9")
        # self.restartall.configure(highlightcolor="#000000")
        # self.restartall.configure(pady="0")
        # self.restartall.configure(text='''Restart All''')
        # self.restartall.configure(width=94)

        # self.stopall = tk.Button(self.Frame1)
        # self.stopall.place(relx=0.797, rely=0.063, height=44, width=97)
        # self.stopall.configure(activebackground="#ececec")
        # self.stopall.configure(activeforeground="#000000")
        # self.stopall.configure(background="#f42b0c")
        # self.stopall.configure(disabledforeground="#a3a3a3")
        # self.stopall.configure(foreground="#000000")
        # self.stopall.configure(highlightbackground="#d9d9d9")
        # self.stopall.configure(highlightcolor="black")
        # self.stopall.configure(pady="0")
        # self.stopall.configure(text='''Stop All''')
        # self.stopall.configure(width=97)

        self.Frame2 = tk.Frame(self.Frame1)
        self.Frame2.place(relx=0.05,
                          rely=0.050,
                          relheight=0.85,
                          relwidth=0.888)
        self.Frame2.configure(relief='groove')
        self.Frame2.configure(borderwidth="2")
        self.Frame2.configure(relief='groove')
        self.Frame2.configure(background="#d9d9d9")
        self.Frame2.configure(width=635)

        self.Label2 = tk.Label(self.Frame2)
        self.Label2.place(relx=0.132, rely=0.03, height=31, width=200)
        self.Label2.configure(background="#d9d9d9")
        self.Label2.configure(disabledforeground="#a3a3a3")
        self.Label2.configure(font=font12)
        self.Label2.configure(foreground="#000000")
        self.Label2.configure(text='''ClientID''')

        self.var_client = StringVar(self.Frame2)
        self.var_client.set("All")  # initial value

        self.textclient = OptionMenu(self.Frame2, self.var_client, "All",
                                     "D7730001", "D7730002", "D7730003",
                                     "D18138", "V7410004")
        # self.textalgoname.place(relx=0.142, rely=0.05, x=-2, y=2)
        self.textclient.place(relx=0.504, rely=0.03, height=31, width=150)

        self.algoname = tk.Label(self.Frame2)
        self.algoname.place(relx=0.142, rely=0.15, height=31, width=150)
        self.algoname.configure(background="#d9d9d9")
        self.algoname.configure(disabledforeground="#a3a3a3")
        self.algoname.configure(font=font12)
        self.algoname.configure(foreground="#000000")
        self.algoname.configure(text='''Algo Name''')
        self.algoname.configure(width=64)

        self.textalgoname = tk.Text(self.Frame2)
        self.textalgoname.place(relx=0.504, rely=0.15, height=24, width=200)
        self.textalgoname.configure(background="#d5b673")
        self.textalgoname.configure(pady="0")
        self.textalgoname.configure(width=97)

        # var = StringVar(self.Frame2)
        # var.set("one") # initial value

        # self.textalgoname = OptionMenu(self.Frame2, var, "one", "two", "three", "four")
        # self.textalgoname.place(relx=0.142, rely=0.05, x=-2, y=2)
        # self.textalgoname.pack()

        self.exchangesegment = tk.Label(self.Frame2)
        self.exchangesegment.place(relx=0.142, rely=0.24, height=31, width=150)
        self.exchangesegment.configure(background="#d9d9d9")
        self.exchangesegment.configure(disabledforeground="#a3a3a3")
        self.exchangesegment.configure(font=font12)
        self.exchangesegment.configure(foreground="#000000")
        self.exchangesegment.configure(text='''Exchange Segment''')
        self.exchangesegment.configure(width=64)

        # self.textexchangesegment = tk.Text(self.Frame2)
        # self.textexchangesegment.place(relx=0.504, rely=0.192, height=24, width=200)
        # self.textexchangesegment.configure(background="#d5b673")
        # self.textexchangesegment.configure(pady="0")
        # # self.textexchangeSegment.configure(placeholder='''Write Exchange Segment Here...''')
        # self.textexchangesegment.configure(width=97)

        self.seg_var = StringVar(self.Frame2)
        self.seg_var.set("NSEFO")  # initial value

        self.textexchangesegment = OptionMenu(self.Frame2, self.seg_var,
                                              "NSECM", "NSEFO", "NSECD",
                                              "MCXFO")
        self.textexchangesegment.place(relx=0.504,
                                       rely=0.24,
                                       height=24,
                                       width=200)
        # print(seg_var)

        self.symbol = tk.Label(self.Frame2)
        self.symbol.place(relx=0.04, rely=0.40, height=78, width=300)
        self.symbol.configure(activebackground="#f9f9f9")
        self.symbol.configure(activeforeground="black")
        self.symbol.configure(background="#d9d9d9")
        self.symbol.configure(disabledforeground="#a3a3a3")
        self.symbol.configure(font=font12)
        self.symbol.configure(foreground="#000000")
        self.symbol.configure(highlightbackground="#d9d9d9")
        self.symbol.configure(highlightcolor="black")
        self.symbol.configure(
            text=
            '''Symbol\n(eg.- Stocks:"COALINDIA",\nMCX:"CRUDEOIL-I",\nFutures:"TATAGLOBAL19OCTFUT",\nOptions:"BANKNIFTY03OCT1926300PE")'''
        )

        self.textsymbol = tk.Text(self.Frame2)
        self.textsymbol.place(relx=0.504, rely=0.40, height=24, width=200)
        self.textsymbol.configure(background="#d5b673")
        self.textsymbol.configure(pady="0")
        self.textsymbol.configure(width=97)

        # self.producttype = tk.Label(self.Frame2)
        # self.producttype.place(relx=0.142, rely=0.476, height=31, width=150)
        # self.producttype.configure(activebackground="#f9f9f9")
        # self.producttype.configure(activeforeground="black")
        # self.producttype.configure(background="#d9d9d9")
        # self.producttype.configure(disabledforeground="#a3a3a3")
        # self.producttype.configure(font=font12)
        # self.producttype.configure(foreground="#000000")
        # self.producttype.configure(highlightbackground="#d9d9d9")
        # self.producttype.configure(highlightcolor="black")
        # self.producttype.configure(text='''Product Type''')

        # self.textproducttype = tk.Text(self.Frame2)
        # self.textproducttype.place(relx=0.504, rely=0.476, height=24, width=200)
        # self.textproducttype.configure(background="#d5b673")
        # self.textproducttype.configure(pady="0")
        # self.textproducttype.configure(width=97)

        # self.ordertype = tk.Label(self.Frame2)
        # self.ordertype.place(relx=0.142, rely=0.618, height=31, width=150)
        # self.ordertype.configure(activebackground="#f9f9f9")
        # self.ordertype.configure(activeforeground="black")
        # self.ordertype.configure(background="#d9d9d9")
        # self.ordertype.configure(disabledforeground="#a3a3a3")
        # self.ordertype.configure(font=font12)
        # self.ordertype.configure(foreground="#000000")
        # self.ordertype.configure(highlightbackground="#d9d9d9")
        # self.ordertype.configure(highlightcolor="black")
        # self.ordertype.configure(text='''Order Type''')

        # self.textordertype = tk.Text(self.Frame2)
        # self.textordertype.place(relx=0.504, rely=0.618, height=24, width=200)
        # self.textordertype.configure(background="#d5b673")
        # self.textordertype.configure(pady="0")
        # self.textordertype.configure(width=97)

        self.orderside = tk.Label(self.Frame2)
        self.orderside.place(relx=0.142, rely=0.650, height=31, width=150)
        self.orderside.configure(activebackground="#f9f9f9")
        self.orderside.configure(activeforeground="black")
        self.orderside.configure(background="#d9d9d9")
        self.orderside.configure(disabledforeground="#a3a3a3")
        self.orderside.configure(font=font12)
        self.orderside.configure(foreground="#000000")
        self.orderside.configure(highlightbackground="#d9d9d9")
        self.orderside.configure(highlightcolor="black")
        self.orderside.configure(text='''Order Side''')

        # self.textorderside = tk.Text(self.Frame2)
        # self.textorderside.place(relx=0.504, rely=0.650, height=24, width=200)
        # self.textorderside.configure(background="#d5b673")
        # self.textorderside.configure(pady="0")
        # self.textorderside.configure(width=97)

        self.buysell_var = StringVar(self.Frame2)
        self.buysell_var.set("BUY")

        sides = ["BUY", "SELL"]

        # def ShowChoice(self):
        #     buysell_var = buysell_var.get()
        #     print(buysell_var)

        tk.Label(self.Frame2, justify=tk.LEFT, padx=20).pack()

        relx = 0.500
        for side in sides:
            tk.Radiobutton(
                self.Frame2,
                text=side,
                padx=20,
                variable=self.buysell_var,
                #   command = setorderside,
                value=side).place(relx=relx,
                                  rely=0.650,
                                  relheight=0.056,
                                  relwidth=0.16)
            relx += 0.170

        # buysell_var.get()

        #

        # self.buyrad = tk.Radiobutton(self.Frame2)
        # self.buyrad.place(relx=0.500, rely=0.650, relheight=0.056
        #         , relwidth=0.097)
        # self.buyrad.configure(activebackground="#ececec")
        # self.buyrad.configure(activeforeground="#000000")
        # self.buyrad.configure(background="#d9d9d9")
        # self.buyrad.configure(disabledforeground="#a3a3a3")
        # self.buyrad.configure(foreground="#000000")
        # self.buyrad.configure(highlightbackground="#d9d9d9")
        # self.buyrad.configure(highlightcolor="black")
        # self.buyrad.configure(justify='left')
        # self.buyrad.configure(text='''BUY''')
        # self.buyrad.configure(variable="BUY")
        # self.buyrad.configure(command=self.,value="BUY")

        # self.sellrad = tk.Radiobutton(self.Frame2)
        # self.sellrad.place(relx=0.700, rely=0.650, relheight=0.056
        #         , relwidth=0.097)
        # self.sellrad.configure(activebackground="#ececec")
        # self.sellrad.configure(activeforeground="#000000")
        # self.sellrad.configure(background="#d9d9d9")
        # self.sellrad.configure(disabledforeground="#a3a3a3")
        # self.sellrad.configure(foreground="#000000")
        # self.sellrad.configure(highlightbackground="#d9d9d9")
        # self.sellrad.configure(highlightcolor="black")
        # self.sellrad.configure(justify='left')s
        # self.sellrad.configure(text='''SELL''')
        # self.sellrad.configure(variable="SELL")

        self.orderquantity = tk.Label(self.Frame2)
        self.orderquantity.place(relx=0.142, rely=0.792, height=31, width=150)
        self.orderquantity.configure(activebackground="#f9f9f9")
        self.orderquantity.configure(activeforeground="black")
        self.orderquantity.configure(background="#d9d9d9")
        self.orderquantity.configure(disabledforeground="#a3a3a3")
        self.orderquantity.configure(font=font12)
        self.orderquantity.configure(foreground="#000000")
        self.orderquantity.configure(highlightbackground="#d9d9d9")
        self.orderquantity.configure(highlightcolor="black")
        self.orderquantity.configure(text='''Order Quantity''')

        self.textorderquantity = tk.Text(self.Frame2)
        self.textorderquantity.place(relx=0.504,
                                     rely=0.792,
                                     height=24,
                                     width=200)
        self.textorderquantity.configure(background="#d5b673")
        self.textorderquantity.configure(pady="0")
        self.textorderquantity.configure(width=97)

        self.updatebutton = tk.Button(self.Frame1)
        self.updatebutton.place(relx=0.400, rely=0.93, height=24, width=97)
        self.updatebutton.configure(activebackground="#ececec")
        self.updatebutton.configure(activeforeground="#000000")
        self.updatebutton.configure(background="#05ad27")
        self.updatebutton.configure(disabledforeground="#a3a3a3")
        self.updatebutton.configure(foreground="#000000")
        self.updatebutton.configure(highlightbackground="#d9d9d9")
        self.updatebutton.configure(highlightcolor="black")
        self.updatebutton.configure(pady="0")
        self.updatebutton.configure(text='''Update''')
        self.updatebutton.configure(width=97)
        self.updatebutton.configure(command=self.UpdateButton)
Ejemplo n.º 30
0
    radSel = radVar.get()
    if radSel == 0: checkbox.configure(text='Blue')
    elif radSel == 1: checkbox.configure(text='Gold')
    elif radSel == 2: checkbox.configure(text='Red')


#Adding Radiobuttons
radVar = tk.IntVar()

radVar.set(99)  #set the default value outside the range of options

for col in range(3):
    radcol = 'rad' + str(col)
    radcol = tk.Radiobutton(checkbox,
                            text=colors[col],
                            variable=radVar,
                            value=col,
                            command=radCall)
    radcol.grid(column=col, row=5, sticky=tk.W)

#Adding label frame
labelsFrame = ttk.LabelFrame(tab2, text="Labels Frame ")
labelsFrame.grid(column=0, row=7, padx=8, pady=4)

ttk.Label(labelsFrame, text="Label1").grid(column=0, row=0)
ttk.Label(labelsFrame, text="Label2").grid(column=1, row=0)
ttk.Label(labelsFrame, text="Label3").grid(column=2, row=0)
ttk.Label(labelsFrame, text="Label4").grid(column=0, row=1)

for child in labelsFrame.winfo_children():
    child.grid_configure(padx=5, pady=5)