def filterPrograms(firstNameNew, middleInitialNew, lastNameNew, genderNew,
                   educationNew, yearNew, ethnicityNew, majorNew, skillsNew):
    global TableMargin
    TableMargin = Frame(window, width=1000)
    TableMargin.pack(side=RIGHT)

    scrollbarx = Scrollbar(TableMargin, orient=HORIZONTAL)
    scrollbary = Scrollbar(TableMargin, orient=VERTICAL)
    global tree
    tree = ttk.Treeview(TableMargin,
                        columns=("Company", "Program", "Demographic",
                                 "Year in College", "Role", "Majors",
                                 'Programming Languages/Software'),
                        height=400,
                        selectmode="extended",
                        yscrollcommand=scrollbary.set,
                        xscrollcommand=scrollbarx.set)

    #COLORS FOR LEFT SIDE
    headerColor = "#f1faee"
    headerTextColor = "black"
    bodyColor = "#a8dadc"
    bodyTextColor = "black"
    skillsColor = "#457b9d"
    skillsTextColor = "white"

    #STYLING FOR LEFT SIDE
    headerCanvas = Canvas(TableMargin,
                          width=490,
                          height=50,
                          bg=headerColor,
                          highlightbackground=headerColor)
    headerCanvas.pack(side=LEFT)
    headerCanvas.place(x=0)
    headerCanvas.tag_lower(headerCanvas)

    bodyCanvas = Canvas(TableMargin,
                        width=490,
                        height=600,
                        bg=bodyColor,
                        highlightbackground=bodyColor)
    bodyCanvas.pack(side=LEFT)
    bodyCanvas.place(x=0, y=50)
    bodyCanvas.tag_lower(headerCanvas)

    skillsCanvas = Canvas(TableMargin,
                          width=490,
                          height=500,
                          bg=skillsColor,
                          highlightbackground=skillsColor)
    skillsCanvas.pack(side=LEFT)
    skillsCanvas.place(x=0, y=280)
    skillsCanvas.tag_lower(bodyCanvas)

    borderCanvas = Canvas(TableMargin,
                          width=2,
                          height=1000,
                          bg="#1d3557",
                          highlightbackground="#1d3557")
    borderCanvas.pack(side=LEFT)
    borderCanvas.place(x=490, y=0)
    borderCanvas.tag_lower(headerCanvas)

    scrollbary.config(command=tree.yview)
    scrollbary.pack(side=RIGHT, fill=Y)
    scrollbarx.config(command=tree.xview)
    scrollbarx.pack(side=BOTTOM, fill=X)
    tree.heading('Company', text="Company", anchor=W)
    tree.heading('Program', text="Program", anchor=W)
    tree.heading('Demographic', text="Demographic", anchor=W)
    tree.heading('Year in College', text="Year in College", anchor=W)
    tree.heading('Role', text="Role", anchor=W)
    tree.heading('Majors', text="Majors", anchor=W)
    tree.heading('Programming Languages/Software',
                 text="Programming Languages/Software",
                 anchor=W)
    tree.column('#0', stretch=YES, minwidth=500, width=500)
    tree.column('#1', stretch=YES, minwidth=175, width=175)
    tree.column('#2', stretch=YES, minwidth=285, width=285)
    tree.column('#3', stretch=YES, minwidth=255, width=255)
    tree.column('#4', stretch=YES, minwidth=120, width=120)
    tree.column('#5', stretch=YES, minwidth=200, width=200)
    tree.column('#6', stretch=YES, minwidth=700, width=700)
    tree.column('#7', stretch=YES, minwidth=400, width=400)

    tree.pack()

    #OPENING CVS FILE
    # filteredPrograms = "filteredPrograms.csv" # separate file that will be shown when filtered
    with open('./Diversity Tech Programs Spreadsheet - Sheet1.csv') as f:
        reader = csv.DictReader(f, delimiter=',')
        rowID = 0  # MAYBE CHANGE TO 1 LATER ????

        RowValue = []
        indexValues = []
        ignoredIndexes = []
        maxIndex = 0

        ListOfList = []
        FinalListOfList = []
        for row in reader:
            RowList = []
            rowID = rowID + 1
            company = row['Company']
            program = row['Program']
            demographic = row['Demographic']
            yearIn = row['Year in College']
            role = row['Role']
            majors = row['Majors']
            skills = row['Programming Languages/Software']

            demographicValue = 0
            yearValue = 0
            roleValue = 0
            majorValue = 0
            skillsValue = 0

            # MAP str(yearNew) TO INT VALUE
            yearList = ["Freshman", "Sophomore", "Junior", "Senior"]
            if str(
                    yearNew
            ) in yearList:  # IF THE USER CHOSE A YEAR, GET THE INT EQUIVALENT
                yearNewINT = yearList.index(yearNew) + 1  #JUNIOR will be 3

            # IF PROGRAM DEMOGRAPHIC CONTAINS USER ETHNICITY, ADD 3pts [MORE IMPORTANT]
            if str(ethnicityNew) in str(demographic):
                demographicValue = demographicValue + 3

            # IF THE USER CHOSE A YEAR, SEE IF THEY GET POINTS
            if str(yearNew) in yearList:
                if str(
                        yearIn
                ) == "Any":  # IF PROGRAM DOESN'T CARE ABOUT YEAR, ADD 1pt
                    yearValue = yearValue + 1
                else:  # ELSE, SEE IF THE YEAR MATCHES TO WHAT THEY WANT.
                    if str(yearNewINT) in str(yearIn):
                        yearValue = yearValue + 1  # IF IT DOES MATCH, ADD 1pt

            # IF THE PROGRAM ROLE CONTAINS USER MAJOR, ADD 1pt
            if str(majorNew) in str(role):
                roleValue = roleValue + 1

            # IF THE PROGRAM MAOJR CONTAINS USER MAJOR, ADD 2pts [MORE IMPORTANT]
            if str(majorNew) in str(majors):
                majorValue = majorValue + 2

            # IF PROGRAM SKILLS CONTAIN USER SKILLS, ADD 1pt PER SKILL
            for skillIndex in range(len(skillsNew)):
                if str(skillsNew[skillIndex]) in str(skills):
                    skillsValue = skillsValue + 1

            # IF PROGRAM DEMOGRAPHIC CONTAINS USERS GENDER, ADD 3pts [MORE IMPORTANT]
            if str(genderNew) in str(demographic):
                demographicValue = demographicValue + 3

            # ADD UP THE VALUES TO SEE HOW IMPORTANT THIS ROW IS
            totalRowValue = demographicValue + yearValue + roleValue + majorValue + skillsValue
            RowValue.append(totalRowValue)
            RowList = [
                company, program, demographic, yearIn, role, majors, skills
            ]
            ListOfList.append(RowList)
            # print("ROW VALUE: ", totalRowValue)

        for t in range(len(RowValue)):
            currentMax = 0
            for i in range(len(RowValue)):
                if i not in ignoredIndexes:
                    if RowValue[i] >= currentMax:
                        currentMax = RowValue[i]
                        maxIndex = i
            ignoredIndexes.append(maxIndex)
            indexValues.append(maxIndex)

        for y in range(len(indexValues)):
            FinalListOfList.append(ListOfList[indexValues[y]])

        for z in range(len(FinalListOfList)):
            valuesNow = FinalListOfList[len(FinalListOfList) - z - 1]
            tree.insert("", 0, values=(valuesNow))

    #FIRST NAME
    firstLabel = Label(window,
                       text="First name: ",
                       font='Helvetica 13 italic',
                       bg=headerColor,
                       fg=headerTextColor)
    global firstNameB
    firstNameB = StringVar()
    firstNameBLabel = Label(window,
                            text=firstNameNew,
                            font='Helvetica 13 bold',
                            bg=headerColor,
                            fg=headerTextColor)
    firstLabel.place(x=15, y=17)
    firstNameBLabel.place(x=105, y=16)

    #MIDDLE INITIAL
    middleLabel = Label(window,
                        text="MI: ",
                        font='Helvetica 13 italic',
                        bg=headerColor,
                        fg=headerTextColor)
    middleLabel.place(x=190, y=17)
    global middleInitialB
    middleInitialB = StringVar()
    middleInitialBLabel = Label(window,
                                text=middleInitialNew,
                                font='Helvetica 13 bold',
                                bg=headerColor,
                                fg=headerTextColor)
    # middleInitialB = Entry(window, width=2, borderwidth=0.5, highlightthickness=0.5, highlightcolor="#b8b8b8", bg="#E5F6DF")
    middleInitialBLabel.place(x=230, y=16)

    #LAST NAME
    lastLabel = Label(window,
                      text="Last name: ",
                      font='Helvetica 13 italic',
                      bg=headerColor,
                      fg=headerTextColor)
    lastLabel.place(x=250, y=17)
    global lastNameB
    lastNameB = StringVar()
    lastNameBLabel = Label(window,
                           text=lastNameNew,
                           font='Helvetica 13 bold',
                           bg=headerColor,
                           fg=headerTextColor)
    # lastNameB = Entry(window, width=10, borderwidth=0.5, highlightthickness=0.5, highlightcolor="#b8b8b8", bg="#E5F6DF")
    lastNameBLabel.place(x=340, y=16)

    #GENDER
    chooseGenderLabel = Label(
        window,
        text="Please choose your current preferred gender: ",
        font='Helvetica 13 italic',
        bg=bodyColor,
        fg=bodyTextColor)
    chooseGenderLabel.place(x=25, y=60)
    global genderChoiceB
    genderChoiceB = StringVar(window)
    genderChoiceB.set(genderNew)
    genderDropdown = OptionMenu(window, genderChoiceB, "Female", "Male",
                                "Genderfluid", "Other")
    genderDropdown.config(bg=bodyColor)
    genderDropdown.place(x=25, y=85)

    #CLASSIFICATION / EDUCATION LEVEL
    classificationLabel = Label(window,
                                text="Current education level?",
                                font='Helvetica 13 italic',
                                bg=bodyColor,
                                fg=bodyTextColor)
    classificationLabel.place(x=25, y=130)
    global classificationB
    classificationB = StringVar()
    highschool = Radiobutton(window,
                             text="High School",
                             variable=classificationB,
                             value="HS")
    highschool.config(bg=bodyColor, fg=bodyTextColor)
    highschool.place(x=25, y=150)
    undergraduate = Radiobutton(window,
                                text="Undergraduate",
                                variable=classificationB,
                                value="UNDERGRAD",
                                command=getYearNew)
    undergraduate.config(bg=bodyColor, fg=bodyTextColor)
    undergraduate.place(x=130, y=150)
    graduate = Radiobutton(window,
                           text="Graduate",
                           variable=classificationB,
                           value="GRAD")
    graduate.config(bg=bodyColor, fg=bodyTextColor)
    graduate.place(x=255, y=150)
    otherEducation = Radiobutton(window,
                                 text="Other",
                                 variable=classificationB,
                                 value="OTHER")
    otherEducation.config(bg=bodyColor, fg=bodyTextColor)
    otherEducation.place(x=345, y=150)
    classificationB.set(educationNew)

    #ETHNICITY
    ethnicityLabel = Label(window,
                           text="What is your ethnicity?",
                           font="Helvetica 13 italic",
                           bg=bodyColor,
                           fg=bodyTextColor)
    ethnicityLabel.place(x=25, y=210)
    global ethnicChoiceB
    ethnicChoiceB = StringVar()
    ethnicChoiceB.set(ethnicityNew)
    ethnicityDropdown = OptionMenu(window, ethnicChoiceB,
                                   "American Indian/Alaska Native", "Asian",
                                   "African American", "Black", "Indian",
                                   "Latino",
                                   "Native Hawaiian/Other Pacific Islander",
                                   "White")
    ethnicityDropdown.config(bg=bodyColor, fg=bodyTextColor)
    ethnicityDropdown.place(x=175, y=210)

    #MAJOR
    majorLabel = Label(window,
                       text="What is your major?",
                       font="Helvetica 13 italic",
                       bg=bodyColor,
                       fg=bodyTextColor)
    majorLabel.place(x=25, y=235)
    global majorChoiceB
    majorChoiceB = StringVar()
    majorChoiceB.set(majorNew)
    majorDropdown = OptionMenu(
        window, majorChoiceB, "Agriculture", "Architecture",
        "Area, Ethnic, Cultural, Gender Studies", "Aviation",
        "Biological/Biomedical", "Business, Management, Marketing",
        "Communication, Journalism", "Communications Technologies/Technicians",
        "Computer Science, Information Science", "Education",
        "Engineering Technologies", "Engineering",
        "English Language, Literature",
        "Family and Consumer Sciences, Human Sciences",
        "Foreign Languages, Literatures, Linguistics",
        "Health Professions, Nurse", "Homeland Security, Law Enforcement",
        "Human Services", "Legal Professions and Studies",
        "Liberal Arts and Sciences Studies, Humanities", "Library Science",
        "Mathematics and Statistics",
        "Mechanical, Repair Technologies/Technicans",
        "Military Technologies/Applied Sciences",
        "Multi/Interdisciplinary Studies",
        "Natural Resources and Conservation",
        "Parks, Recreations, Leisure, and Fitness Studies",
        "Personal and Culinary Studies", "Philosophy and Religious Studies",
        "Physical Sciences", "Precision Production", "Psychology",
        "Science Technologies/Technicians", "Social Sciences",
        "Software Engineering", "Theology, Religious Vocations",
        "Transportation/ Materials Moving", "Visual and Performing Arts",
        "None/Other")
    majorDropdown.config(bg=bodyColor)
    majorDropdown.place(x=175, y=235)

    #PROGRAMMING LANGUAGES
    languagesLabel = Label(
        window,
        text="Select any programming skills you know (scroll): ",
        font="Helvetica 13 italic",
        bg=skillsColor,
        fg=skillsTextColor)
    languagesLabel.place(x=20, y=290)
    global languageDropdown
    languageDropdown = Listbox(window,
                               selectmode="multiple",
                               bd=1,
                               selectbackground="#bee6e5",
                               bg="#e1e8e8")
    languageDropdown.place(x=25, y=315)
    global languageList
    languageList = [
        "C", "C++", "Java", "Python", "R", "Go", "Ruby", "JavaScript", "Swift",
        "PHP", "SQL", "Kotlin", "Perl", "Objective-C", "TypeScript", "Rust",
        "Lua", "Assembly", "COBOL", "Lisp", "MySQL", "MATLAB", "Julia",
        "Visual Basic", "Ruby on Rails", "HTML/CSS"
    ]
    for each_item in range(len(languageList)):
        languageDropdown.insert(END, languageList[each_item])
示例#2
0
            def parties():
                loginframe.destroy()
                partiesframe=Frame(root,height=480,width=800)
                partiesframe.pack()
                background=Label(partiesframe, image=image)
                background.place(x=0,y=0)
                restart = Button(partiesframe, text=' X ', background='white', font=("Helvetica", 10,"bold"), command=Restart)
                restart.place(x=771,y=2)
                PartyInfoLabel = Label(partiesframe, text="PARTY INFORMATION", background='white',fg='Navy Blue', font=("Helvetica", 14,"bold"),width=20)
                PartyInfoLabel.place(x=80, y=155)
                PartyDetailLabel = Label(partiesframe, text="PARTIES DETAILS", background='white',fg='Navy Blue', font=("Helvetica", 14,"bold"),width=15)
                PartyDetailLabel.place(x=513, y=155)
                PartyNameLabel= Label(partiesframe, background='white', text="Party Name:", font=("Helvetica", 12,"bold"),width=10)
                PartyNameLabel.place(x=32, y=200)
                PartylogoLabel= Label(partiesframe, background='white', text="Party Logo:", font=("Helvetica", 12,"bold"),width=10)
                PartylogoLabel.place(x=30, y=250)
                PartylogoEntry= Entry(partiesframe, textvariable=PARTYLOGO, background='white', font=("Helvetica", 15,"bold"), width=15)
                PartylogoEntry.place(x=145, y=249)
                tree = ttk.Treeview(partiesframe, columns=("PartyID", "PartyName", "PartyLogo"), height=5)
                def Database():
                   conn = sqlite3.connect("partiesdatabse.db")
                   cursor = conn.cursor()
                   cursor.execute("CREATE TABLE IF NOT EXISTS `party` (party_id INTEGER NOT NULL  PRIMARY KEY AUTOINCREMENT, partyname TEXT, partylogo BLOB)")
                   cursor.execute("SELECT * FROM `party` ORDER BY `party_id` ASC")
                   fetch = cursor.fetchall()
                   for data in fetch:
                       tree.insert('', 'end', values=(data))
                   cursor.close()
                   conn.close()


                def convertToBinaryData(filename):
                    with open(filename, 'rb') as file:
                        blobData = file.read()
                    return blobData
                    
                def SubmitData():
                    global Name
                    if  PARTYNAME.get() == "" or PARTYLOGO.get() == "":
                        result = tkMessageBox.showwarning('', 'Please Complete The Required Field', icon="warning")
                    else:
                        tree.delete(*tree.get_children())
                        conn = sqlite3.connect("partiesdatabse.db")
                        cursor = conn.cursor()
                        cursor.execute("INSERT INTO `party` (partyname, partylogo) VALUES(?, ?)", (str(PARTYNAME.get()), convertToBinaryData(PARTYLOGO.get())))
                        conn.commit()
                        cursor.execute("SELECT * FROM `party` ORDER BY `party_id` ASC")
                        fetch = cursor.fetchall()
                        for data in fetch:
                            tree.insert('', 'end', values=(data))
                        cursor.close()
                        conn.close()
                        PARTYNAME.set("")
                        PARTYLOGO.set("")
                        Name= ""

                def OnSelected(event):
                    global Name
                    curItem = tree.focus()
                    contents =(tree.item(curItem))
                    selecteditem = contents['values']
                    mem_id = selecteditem[0]
                    PARTYNAME.set("")
                    Name= ""
                    PARTYLOGO.set("Select Image")
                    PARTYNAME.set(selecteditem[1])

                def Partylogo():
                    name = askopenfilename(filetypes =(("Image File", "*.jpg"),("All Files","*.*")),title = "Choose a file.")
                    PARTYLOGO.set(name)

                def DeleteData():
                    global Name
                    if not tree.selection():
                        result = tkMessageBox.showwarning('', 'Please Select Something First!', icon="warning")
                    else:
                        result = tkMessageBox.askquestion('', 'Are you sure you want to delete this record?', icon="warning")
                        if result == 'yes':
                            curItem = tree.focus()
                            contents =(tree.item(curItem))
                            selecteditem = contents['values']
                            tree.delete(curItem)
                            conn = sqlite3.connect("partiesdatabse.db")
                            cursor = conn.cursor()
                            cursor.execute("DELETE FROM `PARTY` WHERE `PARTY_id` = %d" % selecteditem[0])
                            conn.commit()
                            cursor.close()
                            conn.close()
                            PARTYNAME.set("")
                            PARTYLOGO.set("")
                            Name= ""
                            
                Partylogobutton= Button(partiesframe, text=' Browse ', background='white', font=("Helvetica", 10,"bold"), command=Partylogo, width=10)
                Partylogobutton.place(x=270, y=249)
                Submitbutton= Button(partiesframe, text=' SUBMIT ', font=("Helvetica", 10,"bold"), command=SubmitData, width=10)
                Submitbutton.place(x=30, y=300)
                Deletebutton= Button(partiesframe, text=' DELETE ', font=("Helvetica", 10,"bold"), command=DeleteData, width=10)
                Deletebutton.place(x=270, y=300)

                tree.heading('PartyID', text="Party ID")
                tree.heading('PartyName', text=" Party Name ")
                tree.heading('PartyLogo', text=" Party Logo ")
                tree.column('#0', stretch=NO, minwidth=0, width=0)
                tree.column('#1', stretch=NO, minwidth=0, width=0)
                tree.column('#2', stretch=NO, minwidth=0, width=150)
                tree.column('#3', stretch=NO, minwidth=0, width=150)
                tree.place(x=450, y=190)
                tree.bind('<Double-Button-1>',OnSelected)


                Database()

                def press(value):
                    global Name
                    Name=Name+value
                    PARTYNAME.set(Name);
                def clear():
                    global Name
                    Name = ""
                    PARTYNAME.set("")
                    PARTYLOGO.set("")

                PartyNameEntry= Entry(partiesframe, textvariable=PARTYNAME, background='white', font=("Helvetica", 15,"bold"),width=19)
                PartyNameEntry.place(x=145, y=199)
                button1 = Button(partiesframe, text=' Q ',  font=("Helvetica", 15,"bold"), command=lambda: press('Q'), height=1, width=6) 
                button1.place(x=0, y=360) 
                button2 = Button(partiesframe, text=' W ',  font=("Helvetica", 15,"bold"), command=lambda: press('W'), height=1, width=6)
                button2.place(x=80, y=360) 
                button3 = Button(partiesframe, text=' E ',  font=("Helvetica", 15,"bold"), command=lambda: press('E'), height=1, width=6)
                button3.place(x=160, y=360) 
                button4 = Button(partiesframe, text=' R ',  font=("Helvetica", 15,"bold"), command=lambda: press('R'), height=1, width=6) 
                button4.place(x=240, y=360) 
                button5 = Button(partiesframe, text=' T ',  font=("Helvetica", 15,"bold"), command=lambda: press('T'), height=1, width=6) 
                button5.place(x=320, y=360)
                button6 = Button(partiesframe, text=' Y ',  font=("Helvetica", 15,"bold"), command=lambda: press('Y'), height=1, width=6)
                button6.place(x=400, y=360) 
                button7 = Button(partiesframe, text=' U ',  font=("Helvetica", 15,"bold"), command=lambda: press('U'), height=1, width=6)
                button7.place(x=480, y=360) 
                button8 = Button(partiesframe, text=' I ',  font=("Helvetica", 15,"bold"), command=lambda: press('I'), height=1, width=6) 
                button8.place(x=560, y=360) 
                button9 = Button(partiesframe, text=' O ' ,font=("Helvetica", 15,"bold"), command=lambda: press('O'), height=1, width=6)
                button9.place(x=640, y=360)
                button10 = Button(partiesframe, text=' P '   ,font=("Helvetica", 15,"bold"), command=lambda: press('P'), height=1, width=6)
                button10.place(x=720, y=360) 
                button11 = Button(partiesframe, text=' A ',  font=("Helvetica", 15,"bold"), command=lambda: press('A'), height=1, width=6) 
                button11.place(x=0, y=400) 
                button12 = Button(partiesframe, text=' S ',  font=("Helvetica", 15,"bold"), command=lambda: press('S'), height=1, width=6)
                button12.place(x=80, y=400) 
                button13 = Button(partiesframe, text=' D ', font=("Helvetica", 15,"bold"), command=lambda: press('D'), height=1, width=6)
                button13.place(x=160, y=400) 
                button14 = Button(partiesframe, text=' F ', font=("Helvetica", 15,"bold"), command=lambda: press('F'), height=1, width=6) 
                button14.place(x=240, y=400) 
                button15 = Button(partiesframe, text=' G ', font=("Helvetica", 15,"bold"), command=lambda: press('G'), height=1, width=6) 
                button15.place(x=320, y=400)
                button16 = Button(partiesframe, text=' H ',  font=("Helvetica", 15,"bold"), command=lambda: press('H'), height=1, width=6)
                button16.place(x=400, y=400) 
                button17 = Button(partiesframe, text=' J ',  font=("Helvetica", 15,"bold"), command=lambda: press('J'), height=1, width=6)
                button17.place(x=480, y=400) 
                button18 = Button(partiesframe, text=' K ',  font=("Helvetica", 15,"bold"), command=lambda: press('K'), height=1, width=6) 
                button18.place(x=560, y=400) 
                button19 = Button(partiesframe, text=' L ',  font=("Helvetica", 15,"bold"), command=lambda: press('L'), height=1, width=6)
                button19.place(x=640, y=400)
                button20 = Button(partiesframe, text=' Z ',  font=("Helvetica", 15,"bold"), command=lambda: press('Z'), height=1, width=6)
                button20.place(x=720, y=400) 
                button21 = Button(partiesframe, text=' X ',  font=("Helvetica", 15,"bold"), command=lambda: press('X'), height=1, width=6)
                button21.place(x=0, y=440)
                button22 = Button(partiesframe, text=' C ',  font=("Helvetica", 15,"bold"), command=lambda: press('C'), height=1, width=6)
                button22.place(x=80, y=440)
                button23 = Button(partiesframe, text=' V ', font=("Helvetica", 15,"bold"), command=lambda: press('V'), height=1, width=6)
                button23.place(x=160, y=440)
                space = Button(partiesframe, text=' SPACE ',font=("Helvetica", 15,"bold"), command=lambda: press(' ') ,height=1, width=13)
                space.place(x=240, y=440)
                button24 = Button(partiesframe, text=' B ', font=("Helvetica", 15,"bold"), command=lambda: press('B'), height=1, width=6)
                button24.place(x=400, y=440)
                button25 = Button(partiesframe, text=' N ', font=("Helvetica", 15,"bold"), command=lambda: press('N'), height=1, width=6)
                button25.place(x=480, y=440)
                button25 = Button(partiesframe, text=' M ', font=("Helvetica", 15,"bold"), command=lambda: press('M'), height=1, width=6)
                button25.place(x=560, y=440)
                exitbutton = Button(partiesframe, text='  CLEAR  ',  font=("Helvetica", 15,"bold"), command=clear, height=1, width=13) 
                exitbutton.place(x=640, y=440)
                clearbutton= Button(partiesframe, text=' UPDATE ', font=("Helvetica", 10,"bold"), width=10)
                clearbutton.place(x=150, y=300)
示例#3
0
 def test_widget(self):
     columns = ('NO', 'Item', 'Lower', 'Upper', 'Result')
     self.sheet1 = ttk.Treeview(
         self.master,
         height=9,
         show='headings',
         columns=columns,
     )
     for i in columns:
         if i == 'NO':
             self.sheet1.column(i, width=70, anchor='center')
             self.sheet1.heading(i, text=str(i))
         else:
             self.sheet1.column(i, width=150, anchor='center')
             self.sheet1.heading(i, text=str(i))
     self.sheet1.insert('',
                        index=0,
                        value=(
                            '1',
                            'Link Check',
                            'NA',
                            'NA',
                        ))
     self.sheet1.insert('',
                        index=1,
                        value=(
                            '2',
                            'Open Tunnel',
                            'NA',
                            'NA',
                        ))
     self.sheet1.insert('', index=2, value=(
         '3',
         'Read SN',
         'NA',
         'NA',
     ))
     self.sheet1.insert('', index=3, value=(
         '4',
         'MIC3 Test',
         'NA',
         'NA',
     ))
     self.sheet1.insert('',
                        index=4,
                        value=(
                            '5',
                            'Optical Sensor Test',
                            spec_lo,
                            spec_up,
                        ))
     self.sheet1.insert('', index=5, value=(
         '6',
         'Gcal Test',
         'NA',
         'NA',
     ))
     self.sheet1.insert('',
                        index=6,
                        value=(
                            '7',
                            'PCM Test',
                            '8575',
                            '8900',
                        ))
     self.sheet1.insert('',
                        index=7,
                        value=(
                            '8',
                            'Close Tunnel',
                            'NA',
                            'NA',
                        ))
     self.sheet1.pack(fill=BOTH, pady=5)
示例#4
0
    createTree(["Article", "Price per (sek)", "Amount"])
    USER_INP = simpledialog.askinteger(title="Order ID",
                                       prompt="Enter a value (1-200)")
    queryShoppingCart(USER_INP)
    for row in cursor:
        tree.insert("", tk.END, values=row)


# User interface
root = tk.Tk()
root.title("Ica Maxü Retail Store Database")
root.geometry("1000x800")
root.grid()

# Table
tree = ttk.Treeview(root, columns=(1), show='headings')
tree.pack(side='right', fill='y')
tree.column("#1", width=400)

# Buttons
button1 = tk.Button(text="Stores", command=stores)
button1.pack(pady=10)
button2 = tk.Button(text="Average age of customer per store",
                    command=averageAge)
button2.pack(pady=10)
button3 = tk.Button(text="Total amount of customers per store",
                    command=customerCount)
button3.pack(pady=10)
button4 = tk.Button(text="Check Article", command=checkArticle)
button4.pack(pady=10)
button5 = tk.Button(text="Check Orderer", command=checkOrder)
        txt = '{}---{}---{}---{}---{}\n'.format(d[0], d[1], d[2], d[3], d[4])
        text = text + txt

    v_allrecord.set(text)


v_allrecord = StringVar()
v_allrecord.set('-------All Record-------')
Allrecord = ttk.Label(T2,
                      textvariable=v_allrecord,
                      font=(None, 15),
                      foreground='green')
Allrecord.pack()

header = ['วัน-เวลา', 'รายการ', 'ค่าใช้จ่าย', 'จำนวน', 'รวม']
resulttable = ttk.Treeview(T2, columns=header, show='headings', height=10)
resulttable.pack()

for hd in header:
    resulttable.heading(hd, text=hd)

headerwidth = [150, 170, 80, 80, 80]
for hd, W in zip(header, headerwidth):
    resulttable.column(hd, width=W)


def update_table():
    getdata = read_csv()
    for dt in getdata:
        resulttable.insert('', 'end', value=dt)
示例#6
0
def leagueTable(league_code, league_name):
    clearWindow()

    canvas = tk.Canvas(window, width=600, height=600)
    canvas.pack()
    if league_name == "Premier League":
        background = ImageTk.PhotoImage(Image.open("assets/bgprem.png"))
    elif league_name == "LaLiga":
        background = ImageTk.PhotoImage(Image.open("assets/bglaliga.png"))
    elif league_name == "Bundesliga":
        background = ImageTk.PhotoImage(Image.open("assets/bgbundes.png"))
    else:
        background = ImageTk.PhotoImage(Image.open("assets/bgserie.png"))
    canvas.background = background
    canvas.create_image(0, 0, image=background, anchor=NW)

    buttonReturn = tk.Button(text="<- Wróć do lig",
                             width=20,
                             font=("Russo One", 10),
                             command=tables)
    buttonReturn_window = canvas.create_window(80,
                                               15,
                                               anchor=N,
                                               window=buttonReturn)

    info_text = canvas.create_text(300,
                                   50,
                                   anchor=N,
                                   font=("Russo One", 20),
                                   fill="black",
                                   text=league_name)

    #funkcja api.table zwraca nam liste danych o danej lidze, znajduje się ona w pliku api.py
    table_data = api.table(league_code)

    #stworzenie tabeli za pomocą narzędzi z tkinter
    tableFrame = Frame(window)
    tableFrame.pack()

    frame_window = canvas.create_window(300, 300, window=tableFrame)

    tableContent = ttk.Treeview(tableFrame,
                                columns=(1, 2, 3, 4, 5, 6, 7),
                                show="headings",
                                height="20")
    tableContent.pack()

    tableContent.heading(1, text="Miejsce")
    tableContent.column(1, minwidth=0, width=50)
    tableContent.heading(2, text="Nazwa")
    tableContent.column(2, minwidth=0, width=150)
    tableContent.heading(3, text="M")
    tableContent.column(3, minwidth=0, width=50)
    tableContent.heading(4, text="W")
    tableContent.column(4, minwidth=0, width=50)
    tableContent.heading(5, text="R")
    tableContent.column(5, minwidth=0, width=50)
    tableContent.heading(6, text="P")
    tableContent.column(6, minwidth=0, width=50)
    tableContent.heading(7, text="Pkt")
    tableContent.column(7, minwidth=0, width=50)

    #wstawienie rekordów do tabeli
    for item in table_data:
        tableContent.insert('', 'end', values=item)
示例#7
0
# 设置按钮,以及放置的位置
searchBtn = tk.Button(root,
                      text="搜索",
                      fg="blue",
                      bd=2,
                      width=10,
                      command=file_music)  # command中的方法带括号是直接执行,不带括号才是点击执行
searchBtn.place(x=650, y=8, anchor='nw')

update_progress = tk.StringVar()

# 创建滚动条
scroll = tk.Scrollbar()

columns = ("编号", "歌曲", "演唱者", "时长")
treeview = ttk.Treeview(root, height=18, show="headings",
                        columns=columns)  # 表格

treeview.column("编号", width=100, anchor='center')  # 表示列,不显示
treeview.column("歌曲", width=300, anchor='center')
treeview.column("演唱者", width=300, anchor='center')
treeview.column("时长", width=300, anchor='center')

treeview.heading("编号", text="编号")  # 显示表头
treeview.heading("歌曲", text="歌曲")
treeview.heading("演唱者", text="演唱者")
treeview.heading("时长", text="时长")

# side放到窗体的哪一侧,  fill填充
scroll.pack(side=tk.RIGHT, fill=tk.Y)
treeview.pack(side=tk.LEFT, fill=tk.Y)
# 关联
    def __init__(self, top=None, goatData=[]):
        '''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'
        font10 = "-family {Segoe UI} -size 13"
        font12 = "-family {Segoe UI} -size 16 -weight bold"
        font13 = "-family {Segoe UI Semibold} -size 13 -weight bold"
        font9 = "-family {Segoe UI} -size 20 -weight bold"

        top.geometry("1300x760+20+20")
        top.minsize(800, 500)
        top.maxsize(1800, 850)
        top.resizable(1, 1)
        top.title("View")
        top.configure(background="#d9d9d9")
        top.configure(highlightbackground="#d9d9d9")
        top.configure(highlightcolor="black")

        self.goatData = goatData
        self.db = DataBase()

        self.Button0 = tk.Button(top, command=destroy_Toplevel1)
        self.Button0.place(x=10, y=8, height=33, width=56)
        self.Button0.configure(activebackground="#ececec")
        self.Button0.configure(activeforeground="#000000")
        self.Button0.configure(background="#d9d9d9")
        self.Button0.configure(disabledforeground="#a3a3a3")
        self.Button0.configure(foreground="#000000")
        self.Button0.configure(highlightbackground="#d9d9d9")
        self.Button0.configure(highlightcolor="black")
        self.Button0.configure(pady="0")
        self.Button0.configure(text='''< Back''')

        self.Label1 = tk.Label(top)
        self.Label1.place(relx=0.416, rely=0.0, height=52, width=173)
        self.Label1.configure(activebackground="#f9f9f9")
        self.Label1.configure(activeforeground="black")
        self.Label1.configure(background="#d9d9d9")
        self.Label1.configure(disabledforeground="#a3a3a3")
        self.Label1.configure(font=font9)
        self.Label1.configure(foreground="#000000")
        self.Label1.configure(highlightbackground="#d9d9d9")
        self.Label1.configure(highlightcolor="black")
        self.Label1.configure(text='''About Goat''')

        self.Label2 = tk.Label(top)
        self.Label2.place(relx=0.051, rely=0.017, height=52, width=112)
        self.Label2.configure(activebackground="#f9f9f9")
        self.Label2.configure(activeforeground="black")
        self.Label2.configure(background="#d9d9d9")
        self.Label2.configure(disabledforeground="#a3a3a3")
        self.Label2.configure(font=("font10", 10))
        self.Label2.configure(foreground="#000000")
        self.Label2.configure(highlightbackground="#d9d9d9")
        self.Label2.configure(highlightcolor="black")
        self.Label2.configure(text='''Goat ID''')

        self.Label2_1 = tk.Label(top)
        self.Label2_1.place(relx=0.051, rely=0.072, height=52, width=112)
        self.Label2_1.configure(activebackground="#f9f9f9")
        self.Label2_1.configure(activeforeground="black")
        self.Label2_1.configure(background="#d9d9d9")
        self.Label2_1.configure(disabledforeground="#a3a3a3")
        self.Label2_1.configure(font=("font10", 10))
        self.Label2_1.configure(foreground="#000000")
        self.Label2_1.configure(highlightbackground="#d9d9d9")
        self.Label2_1.configure(highlightcolor="black")
        self.Label2_1.configure(text='''Breed''')

        self.Label2_2 = tk.Label(top)
        self.Label2_2.place(relx=0.051, rely=0.134, height=40, width=112)
        self.Label2_2.configure(activebackground="#f9f9f9")
        self.Label2_2.configure(activeforeground="black")
        self.Label2_2.configure(background="#d9d9d9")
        self.Label2_2.configure(disabledforeground="#a3a3a3")
        self.Label2_2.configure(font=("font10", 10))
        self.Label2_2.configure(foreground="#000000")
        self.Label2_2.configure(highlightbackground="#d9d9d9")
        self.Label2_2.configure(highlightcolor="black")
        self.Label2_2.configure(text='''DOB''')

        self.Label2_3 = tk.Label(top)
        self.Label2_3.place(relx=0.051, rely=0.177, height=53, width=112)
        self.Label2_3.configure(activebackground="#f9f9f9")
        self.Label2_3.configure(activeforeground="black")
        self.Label2_3.configure(background="#d9d9d9")
        self.Label2_3.configure(disabledforeground="#a3a3a3")
        self.Label2_3.configure(font=("font10", 10))
        self.Label2_3.configure(foreground="#000000")
        self.Label2_3.configure(highlightbackground="#d9d9d9")
        self.Label2_3.configure(highlightcolor="black")
        self.Label2_3.configure(text='''Gender''')

        self.Label2_4 = tk.Label(top)
        self.Label2_4.place(relx=0.071, rely=0.300, height=52, width=266)
        self.Label2_4.configure(activebackground="#f9f9f9")
        self.Label2_4.configure(activeforeground="black")
        self.Label2_4.configure(background="#d9d9d9")
        self.Label2_4.configure(disabledforeground="#a3a3a3")
        self.Label2_4.configure(font=font12)
        self.Label2_4.configure(foreground="#000000")
        self.Label2_4.configure(highlightbackground="#d9d9d9")
        self.Label2_4.configure(highlightcolor="black")
        self.Label2_4.configure(text='''Last Vaccinated Date''')

        self.Text1 = tk.Text(top)
        self.Text1.place(relx=0.152,
                         rely=0.025,
                         relheight=0.036,
                         relwidth=0.139)
        self.Text1.configure(background="white")
        self.Text1.configure(font="TkTextFont")
        self.Text1.configure(foreground="black")
        self.Text1.configure(highlightbackground="#d9d9d9")
        self.Text1.configure(highlightcolor="black")
        self.Text1.configure(insertbackground="black")
        self.Text1.configure(selectbackground="#c4c4c4")
        self.Text1.configure(selectforeground="black")
        self.Text1.configure(wrap="word")

        self.Text1_12 = tk.Text(top)
        self.Text1_12.place(relx=0.152,
                            rely=0.080,
                            relheight=0.036,
                            relwidth=0.139)
        self.Text1_12.configure(background="white")
        self.Text1_12.configure(font="TkTextFont")
        self.Text1_12.configure(foreground="black")
        self.Text1_12.configure(highlightbackground="#d9d9d9")
        self.Text1_12.configure(highlightcolor="black")
        self.Text1_12.configure(insertbackground="black")
        self.Text1_12.configure(selectbackground="#c4c4c4")
        self.Text1_12.configure(selectforeground="black")
        self.Text1_12.configure(wrap="word")

        self.Text1_12.insert(END, self.goatData[4])

        self.Text1_13 = tk.Text(top)
        self.Text1_13.place(relx=0.152,
                            rely=0.137,
                            relheight=0.035,
                            relwidth=0.139)
        self.Text1_13.configure(background="white")
        self.Text1_13.configure(font="TkTextFont")
        self.Text1_13.configure(foreground="black")
        self.Text1_13.configure(highlightbackground="#d9d9d9")
        self.Text1_13.configure(highlightcolor="black")
        self.Text1_13.configure(insertbackground="black")
        self.Text1_13.configure(selectbackground="#c4c4c4")
        self.Text1_13.configure(selectforeground="black")
        self.Text1_13.configure(wrap="word")

        self.Text1_13.insert(END, self.goatData[2])

        self.Text1_14 = tk.Text(top)
        self.Text1_14.place(relx=0.152,
                            rely=0.190,
                            relheight=0.035,
                            relwidth=0.139)
        self.Text1_14.configure(background="white")
        self.Text1_14.configure(font="TkTextFont")
        self.Text1_14.configure(foreground="black")
        self.Text1_14.configure(highlightbackground="#d9d9d9")
        self.Text1_14.configure(highlightcolor="black")
        self.Text1_14.configure(insertbackground="black")
        self.Text1_14.configure(selectbackground="#c4c4c4")
        self.Text1_14.configure(selectforeground="black")
        self.Text1_14.configure(wrap="word")

        self.Text1_14.insert(END, self.goatData[3])

        self.Text1_15 = tk.Text(top)
        self.Text1_15.place(relx=0.159,
                            rely=0.405,
                            relheight=0.036,
                            relwidth=0.139)
        self.Text1_15.configure(background="white")
        self.Text1_15.configure(font="TkTextFont")
        self.Text1_15.configure(foreground="black")
        self.Text1_15.configure(highlightbackground="#d9d9d9")
        self.Text1_15.configure(highlightcolor="black")
        self.Text1_15.configure(insertbackground="black")
        self.Text1_15.configure(selectbackground="#c4c4c4")
        self.Text1_15.configure(selectforeground="black")
        self.Text1_15.configure(wrap="word")

        self.Text1_15.insert(END, self.goatData[11])

        self.Text1_16 = tk.Text(top)
        self.Text1_16.place(relx=0.159,
                            rely=0.475,
                            relheight=0.036,
                            relwidth=0.139)
        self.Text1_16.configure(background="white")
        self.Text1_16.configure(font="TkTextFont")
        self.Text1_16.configure(foreground="black")
        self.Text1_16.configure(highlightbackground="#d9d9d9")
        self.Text1_16.configure(highlightcolor="black")
        self.Text1_16.configure(insertbackground="black")
        self.Text1_16.configure(selectbackground="#c4c4c4")
        self.Text1_16.configure(selectforeground="black")
        self.Text1_16.configure(wrap="word")

        self.Text1_16.insert(END, self.goatData[12])

        self.Text1_17 = tk.Text(top)
        self.Text1_17.place(relx=0.159,
                            rely=0.540,
                            relheight=0.036,
                            relwidth=0.139)
        self.Text1_17.configure(background="white")
        self.Text1_17.configure(font="TkTextFont")
        self.Text1_17.configure(foreground="black")
        self.Text1_17.configure(highlightbackground="#d9d9d9")
        self.Text1_17.configure(highlightcolor="black")
        self.Text1_17.configure(insertbackground="black")
        self.Text1_17.configure(selectbackground="#c4c4c4")
        self.Text1_17.configure(selectforeground="black")
        self.Text1_17.configure(wrap="word")

        self.Text1_17.insert(END, self.goatData[13])

        self.Text1_18 = tk.Text(top)
        self.Text1_18.place(relx=0.159,
                            rely=0.600,
                            relheight=0.036,
                            relwidth=0.139)
        self.Text1_18.configure(background="white")
        self.Text1_18.configure(font="TkTextFont")
        self.Text1_18.configure(foreground="black")
        self.Text1_18.configure(highlightbackground="#d9d9d9")
        self.Text1_18.configure(highlightcolor="black")
        self.Text1_18.configure(insertbackground="black")
        self.Text1_18.configure(selectbackground="#c4c4c4")
        self.Text1_18.configure(selectforeground="black")
        self.Text1_18.configure(wrap="word")

        self.Text1_18.insert(END, self.goatData[14])

        self.Text1_19 = tk.Text(top)
        self.Text1_19.place(relx=0.159,
                            rely=0.665,
                            relheight=0.036,
                            relwidth=0.139)
        self.Text1_19.configure(background="white")
        self.Text1_19.configure(font="TkTextFont")
        self.Text1_19.configure(foreground="black")
        self.Text1_19.configure(highlightbackground="#d9d9d9")
        self.Text1_19.configure(highlightcolor="black")
        self.Text1_19.configure(insertbackground="black")
        self.Text1_19.configure(selectbackground="#c4c4c4")
        self.Text1_19.configure(selectforeground="black")
        self.Text1_19.configure(wrap="word")

        self.Text1_19.insert(END, self.goatData[15])

        self.Text1_20 = tk.Text(top)
        self.Text1_20.place(relx=0.159,
                            rely=0.730,
                            relheight=0.036,
                            relwidth=0.139)
        self.Text1_20.configure(background="white")
        self.Text1_20.configure(font="TkTextFont")
        self.Text1_20.configure(foreground="black")
        self.Text1_20.configure(highlightbackground="#d9d9d9")
        self.Text1_20.configure(highlightcolor="black")
        self.Text1_20.configure(insertbackground="black")
        self.Text1_20.configure(selectbackground="#c4c4c4")
        self.Text1_20.configure(selectforeground="black")
        self.Text1_20.configure(wrap="word")
        self.Text1_20.insert(END, self.goatData[16])

        self.Text205 = tk.Text(top)
        self.Text205.place(relx=0.159,
                           rely=0.800,
                           relheight=0.036,
                           relwidth=0.139)
        self.Text205.configure(background="white")
        self.Text205.configure(font="TkTextFont")
        self.Text205.configure(foreground="black")
        self.Text205.configure(highlightbackground="#d9d9d9")
        self.Text205.configure(highlightcolor="black")
        self.Text205.configure(insertbackground="black")
        self.Text205.configure(selectbackground="#c4c4c4")
        self.Text205.configure(selectforeground="black")
        self.Text205.configure(wrap="word")
        self.Text205.insert(END, self.goatData[17])

        self.Text305 = tk.Text(top)
        self.Text305.place(relx=0.159,
                           rely=0.865,
                           relheight=0.036,
                           relwidth=0.139)
        self.Text305.configure(background="white")
        self.Text305.configure(font="TkTextFont")
        self.Text305.configure(foreground="black")
        self.Text305.configure(highlightbackground="#d9d9d9")
        self.Text305.configure(highlightcolor="black")
        self.Text305.configure(insertbackground="black")
        self.Text305.configure(selectbackground="#c4c4c4")
        self.Text305.configure(selectforeground="black")
        self.Text305.configure(wrap="word")
        self.Text305.insert(END, self.goatData[18])

        self.Canvas1 = tk.Text(top)
        self.Canvas1.place(relx=0.159,
                           rely=0.927,
                           relheight=0.049,
                           relwidth=0.138)
        self.Canvas1.configure(background="white")
        self.Canvas1.configure(font="TkTextFont")
        self.Canvas1.configure(foreground="black")
        self.Canvas1.configure(highlightbackground="#d9d9d9")
        self.Canvas1.configure(highlightcolor="black")
        self.Canvas1.configure(insertbackground="black")
        self.Canvas1.configure(selectbackground="#c4c4c4")
        self.Canvas1.configure(selectforeground="black")
        self.Canvas1.configure(wrap="word")

        self.Frame2 = tk.Frame(top)
        self.Frame2.place(relx=0.599,
                          rely=0.075,
                          relheight=0.92,
                          relwidth=0.39)
        self.Frame2.configure(relief='groove')
        self.Frame2.configure(borderwidth="2")
        self.Frame2.configure(relief="groove")
        self.Frame2.configure(background="#d9d9d9")
        self.Frame2.configure(highlightbackground="#d9d9d9")
        self.Frame2.configure(highlightcolor="black")

        self.Label2_00 = tk.Label(self.Frame2)
        self.Label2_00.place(relx=0.1, rely=0.066, height=52, width=141)
        self.Label2_00.configure(activebackground="#f9f9f9")
        self.Label2_00.configure(activeforeground="black")
        self.Label2_00.configure(background="#d9d9d9")
        self.Label2_00.configure(disabledforeground="#a3a3a3")
        self.Label2_00.configure(font=font10)
        self.Label2_00.configure(foreground="#000000")
        self.Label2_00.configure(highlightbackground="#d9d9d9")
        self.Label2_00.configure(highlightcolor="black")
        self.Label2_00.configure(text='''Pregnant''')

        self.Canvas2 = tk.Text(self.Frame2)
        self.Canvas2.place(relx=0.469,
                           rely=0.066,
                           relheight=0.055,
                           relwidth=0.346)
        self.Canvas2.configure(background="white")
        self.Canvas2.configure(font="TkTextFont")
        self.Canvas2.configure(foreground="black")
        self.Canvas2.configure(highlightbackground="#d9d9d9")
        self.Canvas2.configure(highlightcolor="black")
        self.Canvas2.configure(insertbackground="black")
        self.Canvas2.configure(selectbackground="#c4c4c4")
        self.Canvas2.configure(selectforeground="black")
        self.Canvas2.configure(wrap="word")

        self.Label2_7 = tk.Label(self.Frame2)
        self.Label2_7.place(relx=0.25, rely=0.15, height=51, width=174)
        self.Label2_7.configure(activebackground="#f9f9f9")
        self.Label2_7.configure(activeforeground="black")
        self.Label2_7.configure(background="#d9d9d9")
        self.Label2_7.configure(disabledforeground="#a3a3a3")
        self.Label2_7.configure(font=font13)
        self.Label2_7.configure(foreground="#000000")
        self.Label2_7.configure(highlightbackground="#d9d9d9")
        self.Label2_7.configure(highlightcolor="black")
        self.Label2_7.configure(text='''Kid Details''')

        self.Label2_8 = tk.Label(self.Frame2)
        self.Label2_8.place(relx=0.1, rely=0.24, height=50, width=140)
        self.Label2_8.configure(activebackground="#f9f9f9")
        self.Label2_8.configure(activeforeground="black")
        self.Label2_8.configure(background="#d9d9d9")
        self.Label2_8.configure(disabledforeground="#a3a3a3")
        self.Label2_8.configure(font=font10)
        self.Label2_8.configure(foreground="#000000")
        self.Label2_8.configure(highlightbackground="#d9d9d9")
        self.Label2_8.configure(highlightcolor="black")
        self.Label2_8.configure(text='''No of Male Kids''')

        self.Text2_9 = tk.Text(self.Frame2)
        self.Text2_9.place(relx=0.469,
                           rely=0.25,
                           relheight=0.055,
                           relwidth=0.346)
        self.Text2_9.configure(background="white")
        self.Text2_9.configure(font="TkTextFont")
        self.Text2_9.configure(foreground="black")
        self.Text2_9.configure(highlightbackground="#d9d9d9")
        self.Text2_9.configure(highlightcolor="black")
        self.Text2_9.configure(insertbackground="black")
        self.Text2_9.configure(selectbackground="#c4c4c4")
        self.Text2_9.configure(selectforeground="black")
        self.Text2_9.configure(wrap="word")
        self.Text2_9.insert(END, self.goatData[8])

        self.Label2_6 = tk.Label(self.Frame2)
        self.Label2_6.place(relx=0.1, rely=0.34, height=50, width=141)
        self.Label2_6.configure(activebackground="#f9f9f9")
        self.Label2_6.configure(activeforeground="black")
        self.Label2_6.configure(background="#d9d9d9")
        self.Label2_6.configure(disabledforeground="#a3a3a3")
        self.Label2_6.configure(font=font10)
        self.Label2_6.configure(foreground="#000000")
        self.Label2_6.configure(highlightbackground="#d9d9d9")
        self.Label2_6.configure(highlightcolor="black")
        self.Label2_6.configure(text='''No of Female Kids''')

        self.Text2 = tk.Text(self.Frame2)
        self.Text2.place(relx=0.469,
                         rely=0.35,
                         relheight=0.055,
                         relwidth=0.346)
        self.Text2.configure(background="white")
        self.Text2.configure(font="TkTextFont")
        self.Text2.configure(foreground="black")
        self.Text2.configure(highlightbackground="#d9d9d9")
        self.Text2.configure(highlightcolor="black")
        self.Text2.configure(insertbackground="black")
        self.Text2.configure(selectbackground="#c4c4c4")
        self.Text2.configure(selectforeground="black")
        self.Text2.configure(wrap="word")
        self.Text2.insert(END, self.goatData[9])

        self.Frame3 = tk.Frame(self.Frame2)
        self.Frame3.place(relx=0.234,
                          rely=0.525,
                          relheight=0.442,
                          relwidth=0.612)
        self.Frame3.configure(relief='groove')
        self.Frame3.configure(borderwidth="2")
        self.Frame3.configure(relief="groove")
        self.Frame3.configure(background="#d9d9d9")

        self.tree3 = ttk.Treeview(self.Frame3)
        self.tree3.place(relx=0.00, rely=0.00, height=300, width=310)
        self.tree3["columns"] = ("#0", "#1", "#2", "#3")
        self.tree3.column("#0", width=50, stretch=True, anchor='center')
        self.tree3.column("#1", width=80, stretch=True, anchor='center')
        self.tree3.column("#2", width=80, stretch=True, anchor='center')
        self.tree3.column("#3", width=80, stretch=True, anchor='center')
        self.tree3.heading("#0", text="S.NO")
        self.tree3.heading("#1", text="MOTHER ID")
        self.tree3.heading("#2", text="KID ID")
        self.tree3.heading("#3", text="GENDER")

        self.Label2_1 = tk.Label(top)
        self.Label2_1.place(relx=0.041, rely=0.390, height=53, width=113)
        self.Label2_1.configure(activebackground="#f9f9f9")
        self.Label2_1.configure(activeforeground="black")
        self.Label2_1.configure(background="#d9d9d9")
        self.Label2_1.configure(disabledforeground="#a3a3a3")
        self.Label2_1.configure(font=("font10", 10))
        self.Label2_1.configure(foreground="#000000")
        self.Label2_1.configure(highlightbackground="#d9d9d9")
        self.Label2_1.configure(highlightcolor="black")
        self.Label2_1.configure(text='''Anthrax''')

        self.Label2_2 = tk.Label(top)
        self.Label2_2.place(relx=0.011, rely=0.460, height=52, width=195)
        self.Label2_2.configure(activebackground="#f9f9f9")
        self.Label2_2.configure(activeforeground="black")
        self.Label2_2.configure(background="#d9d9d9")
        self.Label2_2.configure(disabledforeground="#a3a3a3")
        self.Label2_2.configure(font=("font10", 10))
        self.Label2_2.configure(foreground="#000000")
        self.Label2_2.configure(highlightbackground="#d9d9d9")
        self.Label2_2.configure(highlightcolor="black")
        self.Label2_2.configure(text='''Haemorrhagic Septicemia(H.S)''')

        self.Label2_3 = tk.Label(top)
        self.Label2_3.place(relx=0.041, rely=0.530, height=53, width=113)
        self.Label2_3.configure(activebackground="#f9f9f9")
        self.Label2_3.configure(activeforeground="black")
        self.Label2_3.configure(background="#d9d9d9")
        self.Label2_3.configure(disabledforeground="#a3a3a3")
        self.Label2_3.configure(font=("font10", 10))
        self.Label2_3.configure(foreground="#000000")
        self.Label2_3.configure(highlightbackground="#d9d9d9")
        self.Label2_3.configure(highlightcolor="black")
        self.Label2_3.configure(text='''Enterotoxaemia''')

        self.Label2_5 = tk.Label(top)
        self.Label2_5.place(relx=0.041, rely=0.590, height=52, width=114)
        self.Label2_5.configure(activebackground="#f9f9f9")
        self.Label2_5.configure(activeforeground="black")
        self.Label2_5.configure(background="#d9d9d9")
        self.Label2_5.configure(disabledforeground="#a3a3a3")
        self.Label2_5.configure(font=("font10", 10))
        self.Label2_5.configure(foreground="#000000")
        self.Label2_5.configure(highlightbackground="#d9d9d9")
        self.Label2_5.configure(highlightcolor="black")
        self.Label2_5.configure(text='''Black Quarter''')

        self.Label2_5 = tk.Label(top)
        self.Label2_5.place(relx=0.011, rely=0.655, height=52, width=195)
        self.Label2_5.configure(activebackground="#f9f9f9")
        self.Label2_5.configure(activeforeground="black")
        self.Label2_5.configure(background="#d9d9d9")
        self.Label2_5.configure(disabledforeground="#a3a3a3")
        self.Label2_5.configure(font=("font10", 10))
        self.Label2_5.configure(foreground="#000000")
        self.Label2_5.configure(highlightbackground="#d9d9d9")
        self.Label2_5.configure(highlightcolor="black")
        self.Label2_5.configure(text='''P.P.R.''')

        self.Label2_5 = tk.Label(top)
        self.Label2_5.place(relx=0.011, rely=0.720, height=52, width=180)
        self.Label2_5.configure(activebackground="#f9f9f9")
        self.Label2_5.configure(activeforeground="black")
        self.Label2_5.configure(background="#d9d9d9")
        self.Label2_5.configure(disabledforeground="#a3a3a3")
        self.Label2_5.configure(font=("font10", 10))
        self.Label2_5.configure(foreground="#000000")
        self.Label2_5.configure(highlightbackground="#d9d9d9")
        self.Label2_5.configure(highlightcolor="black")
        self.Label2_5.configure(text='''Foot and Mouth Disease''')

        self.label205 = tk.Label(top)
        self.label205.place(relx=0.041, rely=0.790, height=52, width=113)
        self.label205.configure(activebackground="#f9f9f9")
        self.label205.configure(activeforeground="black")
        self.label205.configure(background="#d9d9d9")
        self.label205.configure(disabledforeground="#a3a3a3")
        self.label205.configure(font=("font10", 10))
        self.label205.configure(foreground="#000000")
        self.label205.configure(highlightbackground="#d9d9d9")
        self.label205.configure(highlightcolor="black")
        self.label205.configure(text='''Goat Pox''')

        self.label305 = tk.Label(top)
        self.label305.place(relx=0.041, rely=0.860, height=52, width=113)
        self.label305.configure(activebackground="#f9f9f9")
        self.label305.configure(activeforeground="black")
        self.label305.configure(background="#d9d9d9")
        self.label305.configure(disabledforeground="#a3a3a3")
        self.label305.configure(font=("font10", 10))
        self.label305.configure(foreground="#000000")
        self.label305.configure(highlightbackground="#d9d9d9")
        self.label305.configure(highlightcolor="black")
        self.label305.configure(text='''C.C.P.P''')

        self.Label2_5 = tk.Label(top)
        self.Label2_5.place(relx=0.051, rely=0.923, height=52, width=93)
        self.Label2_5.configure(activebackground="#f9f9f9")
        self.Label2_5.configure(activeforeground="black")
        self.Label2_5.configure(background="#d9d9d9")
        self.Label2_5.configure(disabledforeground="#a3a3a3")
        self.Label2_5.configure(font=font13)
        self.Label2_5.configure(foreground="#000000")
        self.Label2_5.configure(highlightbackground="#d9d9d9")
        self.Label2_5.configure(highlightcolor="black")
        self.Label2_5.configure(text='''Mortality''')

        self.Label2_5 = tk.Label(top)
        self.Label2_5.place(relx=0.051, rely=0.238, height=52, width=113)
        self.Label2_5.configure(activebackground="#f9f9f9")
        self.Label2_5.configure(activeforeground="black")
        self.Label2_5.configure(background="#d9d9d9")
        self.Label2_5.configure(disabledforeground="#a3a3a3")
        self.Label2_5.configure(font=("font10", 10))
        self.Label2_5.configure(foreground="#000000")
        self.Label2_5.configure(highlightbackground="#d9d9d9")
        self.Label2_5.configure(highlightcolor="black")
        self.Label2_5.configure(text='''Weight''')

        self.Text1_5 = tk.Text(top)
        self.Text1_5.place(relx=0.152,
                           rely=0.250,
                           relheight=0.036,
                           relwidth=0.139)
        self.Text1_5.configure(background="white")
        self.Text1_5.configure(font="TkTextFont")
        self.Text1_5.configure(foreground="black")
        self.Text1_5.configure(highlightbackground="#d9d9d9")
        self.Text1_5.configure(highlightcolor="black")
        self.Text1_5.configure(insertbackground="black")
        self.Text1_5.configure(selectbackground="#c4c4c4")
        self.Text1_5.configure(selectforeground="black")
        self.Text1_5.configure(wrap="word")

        self.Text1_5.insert(END, self.goatData[5])

        self.Text1.insert(END, self.goatData[0])

        self.isAlive = self.goatData[10]
        self.Canvas1.insert(END, self.isAlive)

        self.isPregnant = self.goatData[4]
        self.Canvas2.insert(END, self.isPregnant)

        if goatData[3] == 'm':
            self.Frame2.place_forget()

        self.populateTree()

        counter = 0

        self.Frame1 = tk.Frame(top)
        self.Frame1.place(relx=0.325,
                          rely=0.512,
                          relheight=0.45,
                          relwidth=0.237)
        self.Frame1.configure(relief='groove')
        self.Frame1.configure(borderwidth="2")
        self.Frame1.configure(relief="groove")
        self.Frame1.configure(background="#d9d9d9")
        self.Frame1.configure(highlightbackground="#d9d9d9")
        self.Frame1.configure(highlightcolor="black")

        # Weight graph
        data1 = self.db.getWeightRecords(goatData[0])
        dataColumns1 = self.db.getWeightColumnNames(goatData[0])
        df = pd.DataFrame(data1, columns=dataColumns1)

        figure = plt.Figure(figsize=(6, 7), dpi=50)
        ax1 = figure.add_subplot(111)
        line2 = FigureCanvasTkAgg(figure, self.Frame1)
        line2.get_tk_widget().pack(side=tk.LEFT, fill=tk.NONE, padx=2)
        df.plot(kind='line',
                legend=True,
                ax=ax1,
                color='r',
                marker='o',
                fontsize=15)
        ax1.set_title('Chart of Growth')
        ax1.set_xlabel('Date_checked')
        ax1.set_xticks(np.arange(df.shape[0]) + 0.5, minor=False)
        ax1.set_xticklabels(df.date_checked, rotation=45, fontsize=10)
from tkinter import *
from tkinter import ttk
 
root = Tk() 
tree = ttk.Treeview(root)
 
tree["columns"]=("one","two")
tree['show'] = 'headings' #hides first column
tree.column("one", width=100 )
tree.column("two", width=100)
tree.heading("one", text="coulmn A")
tree.heading("two", text="column B")
 
tree.insert("" , 0,    text="Line 1", values=("1A","1b"))
 
id2 = tree.insert("", 1, "dir2", text="Dir 2")
tree.insert(id2, "end", "dir 2", text="sub dir 2", values=("2A","2B"))
 
##alternatively:
tree.insert("", 3, "dir3", text="Dir 3")
tree.insert("dir3", 3, text=" sub dir 3",values=("3A"," 3B"))
 
tree.pack()
root.mainloop()
示例#10
0
    def Regi(self):
        # verdele het form in een gid voor het possitioneren van de gui elementen
        self.grid()
        # label naam
        label_Sys = tkinter.Label(self,
                                  text='Batch Registratie systeem ',
                                  font=('Calibri', 20),
                                  anchor='e')
        label_Sys.grid(column=3, row=1, sticky='EW')

        # label batch
        label_Batch = tkinter.Label(self, text='Batch ID: ', anchor="w")
        label_Batch.grid(column=0, row=1, sticky='EW', pady=5)

        # entry batch
        self.Entry_Batch = ttk.Entry(self)
        self.Entry_Batch.grid(column=1, row=1, sticky='EW', pady=5)

        # label locatie
        label_Locatie = tkinter.Label(self, text='Locatie: ', anchor="w")
        label_Locatie.grid(column=0, row=2, sticky='EW', pady=5)

        # entry locatie
        self.Entry_Locatie = ttk.Entry(self)
        self.Entry_Locatie.grid(column=1, row=2, sticky='EW', pady=5)

        # label opslag
        label_Opslag = tkinter.Label(self, text='Opslag: ', anchor="w")
        label_Opslag.grid(column=0, row=3, sticky='EW', pady=5)

        # entry opslag
        self.Entry_Opslag = ttk.Entry(self)
        self.Entry_Opslag.grid(column=1, row=3, sticky='EW', pady=5)

        # label medewerker
        label_Medewerker = tkinter.Label(self,
                                         text='Medewerker ID: ',
                                         anchor="w")
        label_Medewerker.grid(column=0, row=4, sticky='EW', pady=5)

        # entry medewerker
        self.Entry_Medewerker = ttk.Entry(self)
        self.Entry_Medewerker.grid(column=1, row=4, sticky='EW', pady=5)

        # label apparaat
        label_Apparaat = tkinter.Label(self, text='Recycle: ', anchor="w")
        label_Apparaat.grid(column=0, row=5, sticky='EW', pady=5)

        # entry apparaat
        self.Entry_Apparaat = ttk.Entry(self)
        self.Entry_Apparaat.grid(column=1, row=5, sticky='EW', pady=5)

        # label aantal
        label_Aantal = tkinter.Label(self, text='Aantal: ', anchor="w")
        label_Aantal.grid(column=0, row=6, sticky='EW', pady=5)

        # entry apparaat
        self.Entry_Aantal = ttk.Entry(self)
        self.Entry_Aantal.grid(column=1, row=6, sticky='EW', pady=5)

        # label inkom datum
        label_inkom = tkinter.Label(self, text='Inkomst datum: ', anchor="w")
        label_inkom.grid(column=0, row=7, sticky='EW', pady=5)

        # entry inkom datum
        self.Entry_inkom = ttk.Entry(self)
        self.Entry_inkom.grid(column=1, row=7, sticky='EW', pady=5)

        # label sloop datum
        label_sloop = tkinter.Label(self, text='Sloop datum: ', anchor="w")
        label_sloop.grid(column=0, row=8, sticky='EW', pady=5)

        # entry sloop datum
        self.Entry_sloop = ttk.Entry(self)
        self.Entry_sloop.grid(column=1, row=8, sticky='EW', pady=5)

        # label voortgang
        label_voortgang = tkinter.Label(self, text='Voortgang: ', anchor="w")
        label_voortgang.grid(column=0, row=9, sticky='EW', pady=5)

        # entry voortgang
        self.Entry_voortgang = ttk.Entry(self)
        self.Entry_voortgang.grid(column=1, row=9, sticky='EW', pady=5)

        # Button set data
        button_set = tkinter.Button(self,
                                    text='Voeg batch toe',
                                    command=self.InsertBatch)
        button_set.grid(column=0, row=10, sticky='EW', pady=5, padx=5)

        # Button Get data
        button_update = tkinter.Button(self,
                                       text='Update batch',
                                       command=self.UpdateBatch)
        button_update.grid(column=1, row=10, sticky='EW', pady=5, padx=5)

        # Button haal lijst op
        button_lijst = tkinter.Button(self,
                                      text='Refresh lijst',
                                      command=self.Getbatch)
        button_lijst.grid(column=0, row=11, sticky='EW', pady=5, padx=5)

        # Button Details
        button_detail = tkinter.Button(self,
                                       text='Meer details',
                                       command=self.OpenDetail)
        button_detail.grid(column=1, row=11, sticky='EW', pady=5, padx=5)

        # Button Details
        button_Moverzicht = tkinter.Button(self,
                                           text='Medewerker Overzicht',
                                           command=self.MedewerkerOverzicht)
        button_Moverzicht.grid(column=0,
                               row=12,
                               columnspan=2,
                               sticky='EW',
                               pady=5,
                               padx=5)

        # Set the treeview
        self.tree = ttk.Treeview(self,
                                 columns=('Batch_ID', 'Adres', 'Adres',
                                          'Omschrijving', 'Naam', 'Naam',
                                          'Aantal', 'Inkomst_datum',
                                          'Sloop_Datum', 'Voortgang'))
        # naam/ positie waardes voor de treeview
        self.tree.heading('#1', text='batch ID')
        self.tree.heading('#2', text='Locatie Adres')
        self.tree.heading('#5', text='Medewerker')
        self.tree.heading('#6', text='Recyclenaam')
        self.tree.heading('#7', text='Aantal')
        self.tree.column('#0', minwidth=0)
        self.tree.column('#0', width=0)
        self.tree.column('#3', minwidth=0)
        self.tree.column('#3', width=0)
        self.tree.column('#4', minwidth=0)
        self.tree.column('#4', width=0)
        self.tree.column('#8', minwidth=0)
        self.tree.column('#8', width=0)
        self.tree.column('#9', minwidth=0)
        self.tree.column('#9', width=0)
        self.tree.column('#10', minwidth=0)
        self.tree.column('#10', width=0)
        self.tree.grid(column=2,
                       row=2,
                       columnspan=4,
                       rowspan=10,
                       sticky='nsew',
                       padx=5)
        self.tree.bind("<Double-1>", self.OnDoubleClick)
示例#11
0
    def DetailWindow(self):
        # verdele het form in een gid voor het possitioneren van de gui elementen
        self.grid()
        # label naam
        label_Sys = tkinter.Label(self,
                                  text='Opbrengst Batch ',
                                  font=('Calibri', 20),
                                  anchor='e')
        label_Sys.grid(column=3, row=1, sticky='EW')

        # label batch
        label_Batch = tkinter.Label(self, text='Batch ID: ', anchor="w")
        label_Batch.grid(column=0, row=2, sticky='EW')

        # entry batch
        self.Entry_Batch = ttk.Entry(self)
        self.Entry_Batch.grid(column=1, row=2, sticky='EW')

        # label materiaal
        label_Materiaal = tkinter.Label(self,
                                        text='Materiaal ID: ',
                                        anchor="w")
        label_Materiaal.grid(column=0, row=3, sticky='EW')

        # entry materiaal
        self.Entry_Materiaal = ttk.Entry(self)
        self.Entry_Materiaal.grid(column=1, row=3, sticky='EW')

        # label killogram
        label_Kilo = tkinter.Label(self, text='Kilogram: ', anchor="w")
        label_Kilo.grid(column=0, row=4, sticky='EW')

        # entry killogram
        self.Entry_Kilo = ttk.Entry(self)
        self.Entry_Kilo.grid(column=1, row=4, sticky='EW')

        # label totaal
        label_Totaal = tkinter.Label(self,
                                     text='Totaal Waarde €: ',
                                     anchor="w")
        label_Totaal.grid(column=0, row=5, sticky='EW')

        # entry totaal
        self.Entry_Totaal = ttk.Entry(self, state='disabled')
        self.Entry_Totaal.grid(column=1, row=5, sticky='EW')

        # Button get details
        button_overzicht = tkinter.Button(self,
                                          text='Geef opbrengst weer',
                                          command=self.GetMateriaal)
        button_overzicht.grid(column=0, row=6, sticky='EW')

        # Button Insert
        button_Insert = tkinter.Button(self,
                                       text='Voeg materiaal toe',
                                       command=self.InsertMateriaal)
        button_Insert.grid(column=1, row=6, sticky='EW')

        # Set the treeview
        self.tree = ttk.Treeview(self,
                                 columns=('Materiaal', 'Recyclebaar',
                                          'Kilogram', 'Waarde'))
        # naam/ positie waardes voor de treeview
        self.tree.heading('#1', text='Materiaal')
        self.tree.heading('#2', text='Recyclebaar')
        self.tree.heading('#3', text='Kilogram')
        self.tree.heading('#4', text='Waarde in €')
        self.tree.column('#0', minwidth=0)
        self.tree.column('#0', width=0)
        self.tree.grid(column=2,
                       row=2,
                       columnspan=4,
                       rowspan=10,
                       sticky='nsew',
                       pady=5,
                       padx=5)
示例#12
0
import tkinter
from tkinter import ttk

win = tkinter.Tk()
win.title("sunck")
win.geometry("600x400+200+20")

#表格
tree = ttk.Treeview(win)
tree.pack()

#定义列
tree["columns"] = ("姓名", "年龄", "身高", "体重")
#设置列,列还不显示
tree.column("姓名", width=100)
tree.column("年龄", width=100)
tree.column("身高", width=100)
tree.column("体重", width=100)

#设置表头
tree.heading("姓名", text="姓名-name")
tree.heading("年龄", text="年龄-age")
tree.heading("身高", text="身高-height")
tree.heading("体重", text="体重-weight")

#添加数据
tree.insert("", 0, text="line1", values=("陆彦旭", "28", "165", "80"))
tree.insert("", 1, text="line2", values=("范育宾", "29", "167", "70"))

win.mainloop()
示例#13
0
## 트리뷰 활용
from tkinter import *
from tkinter import ttk

window = Tk()
window.geometry('800x500')
sheet = ttk.Treeview(window)
# 첫번째 열 만들기
sheet.column('#0', width=70)  # 첫 컬럼의 내부이름
sheet.heading('#0', text='제목1')
# 두번째 이후 열 만들기

sheet['columns'] = ("A", "B", "C")  # 컬럼의 내부이름
sheet.column("A", width=70)
sheet.heading('A', text='제목2')
sheet.column("B", width=70)
sheet.heading('B', text='제목3')
sheet.column("C", width=70)
sheet.heading('C', text='제목4')

#내용 채우기
sheet.insert('', 'end', text='1열값1', values=('2열값1', '3열값1', '4열값1'))
sheet.insert('', 'end', text='1열값2', values=('2열값2', '3열값2', '4열값2'))
sheet.insert('', 'end', text='1열값3', values=('2열값3', '3열값3', '4열값3'))

sheet.pack()
window.mainloop()
示例#14
0
    def __init__(self):
        tk.Frame.__init__(self)

        # If these are not equal, then orbitals need to be an oval
        self.canvasH = 1000
        self.canvasW = 1000
        # Left Canvas is the planetary treeview
        self.leftCanvas = tk.Canvas(self,
                                    height=self.canvasH,
                                    width=100,
                                    bg='white')
        self.leftCanvas.pack(side=tk.LEFT, expand=1, fill=tk.Y)
        self.tree = ttk.Treeview(self.leftCanvas,
                                 columns=('Systems'),
                                 height=100)
        # Shows the planet and ships n stuff
        self.canvas = tk.Canvas(self,
                                height=self.canvasH,
                                width=self.canvasW,
                                bg='grey')
        self.canvas.pack(side=tk.LEFT)
        self.zoomLevelDefault = 1
        self.zoomLevel = 1
        self.zoomLevelChange = 0.2
        # Current centre of the system - the star centre upon creation
        self.starX = self.canvasW / 2
        self.starY = self.canvasH / 2
        # The centre of the canvas
        self.centreX = self.starX
        self.centreY = self.starY

        self.zoomOffsetX = 0
        self.zoomOffsetY = 0

        self.starRadius = 25
        self.planetRadius = 5
        self.moonRadius = 3
        self.starTextOffset = 5 + self.starRadius * 1.3
        self.planetTextOffset = 5 + self.planetRadius * 1.3

        # Generate the galaxy here, TODO need to move this to a main at some point
        self.galaxy = Galaxy.Galaxy()
        self.mySystem = self.galaxy.systems[0]

        self.planetWidgets = []
        self.planetName = []

        # tkinter stuff related to the class
        button1 = tk.Button(self,
                            text="Update",
                            width=75,
                            command=self.redrawCanvas)
        button1.pack(side=tk.BOTTOM)

        # keybindngs
        self.bind('=', self.keyonCanvas)
        self.bind('-', self.keyonCanvas)
        self.bind('w', self.keyonCanvas)
        self.bind('s', self.keyonCanvas)
        self.bind('a', self.keyonCanvas)
        self.bind('d', self.keyonCanvas)
        # Mouse button events
        self.canvas.bind('<Button-1>', self.focusOnClickedObject)
        self.bind('<Enter>', self.mouseFocus)
        # Generate Widgets
        self.generateLeftCanvas()
        self.lastItemOnTreeview = ":".join(
            ("STAR", self.galaxy.systems[0].name))
        self.createTreeviewSystemData(self.mySystem, self.lastItemOnTreeview)
        self.treeview.item(self.lastItemOnTreeview, open=True)

        self.generateCanvas()
示例#15
0
from tkinter import *
import tkinter.ttk as tkrttk

screen = Tk()
screen.geometry("450x200")

treetime = tkrttk.Treeview(screen)

treetime["columns"] = ("Column 2", "Column 3", "Column 4", "Column 5")

treetime.column('#0', width=250, minwidth=25, stretch=NO)
treetime.column('Column 2', width=50, minwidth=25, stretch=NO)
treetime.column('Column 3', width=50, minwidth=25, stretch=NO)
treetime.column('Column 4', width=50, minwidth=25, stretch=NO)
treetime.column('Column 5', width=50, minwidth=25, stretch=NO)

treetime.heading("#0", text="Column 1", anchor=W)
treetime.heading("Column 2", text="Column 2", anchor=W)
treetime.heading("Column 3", text="Column 3", anchor=W)
treetime.heading("Column 4", text="Column 4", anchor=W)
treetime.heading("Column 5", text="Column 5", anchor=W)

#1st LEVEL
Row1 = treetime.insert("",
                       1,
                       text="First Row",
                       values=("B1", "C1", "D1", "E1"))
Row2 = treetime.insert("",
                       2,
                       text="Second Row",
                       values=("B1", "C1", "D1", "E1"))
示例#16
0
                          bd=1,
                          fg="#6E0B71",
                          activebackground="#091833").place(x=700,
                                                            y=450,
                                                            width=130,
                                                            height=25)

List_fact_frm5 = tk.LabelFrame(app,
                               width=830,
                               height=300,
                               bg="#4F5A5E",
                               bd=4,
                               font=("Arial Greek", 9, "bold"),
                               fg="white").place(x=10, y=540)

tree = ttk.Treeview(app)

tree["columns"] = ("one", "two")
tree.column("one", width=150)
tree.column("two", width=100)
tree.heading("one", text="column A")
tree.heading("two", text="column B")

tree.place(x=17, y=550, width=815)
#tree.pack()

lbl2 = tk.Label(app, font=("times new roman", 13, "bold"), bg="#4F5A8B")


def clock():
    string = strftime('%y-%m-%d' '  ' '%H:%M:%S %p')
# ============================ENTRY=======================================

# ============================BUTTONS=====================================
btn_add = Button(MidLeft, text="+ ADD NEW", bg="#66ff66", command=AddNewWindow)
btn_add.pack()
btn_delete = Button(MidRight, text="- DELETE", bg="red", command=DeleteData)
btn_delete.pack(side=RIGHT)

# ============================TABLES======================================
scrollbarx = Scrollbar(TableMargin, orient=HORIZONTAL)
scrollbary = Scrollbar(TableMargin, orient=VERTICAL)
tree = ttk.Treeview(TableMargin,
                    columns=("MemberID", "Firstname", "Lastname", "Gender",
                             "Age", "Address", "Contact"),
                    height=400,
                    selectmode="extended",
                    yscrollcommand=scrollbary.set,
                    xscrollcommand=scrollbarx.set)
scrollbary.config(command=tree.yview)
scrollbary.pack(side=RIGHT, fill=Y)
scrollbarx.config(command=tree.xview)
scrollbarx.pack(side=BOTTOM, fill=X)
tree.heading('MemberID', text="MemberID", anchor=W)
tree.heading('Firstname', text="BOOK NAME", anchor=W)
tree.heading('Lastname', text="STUDENT NAME", anchor=W)
tree.heading('Gender', text="Gender", anchor=W)
tree.heading('Age', text="ID", anchor=W)
tree.heading('Address', text="ISSUED DATE", anchor=W)
tree.heading('Contact', text="STUDENT PHONE NUMBER", anchor=W)
tree.column('#0', stretch=NO, minwidth=0, width=0)
    def __init__(self):
        Toplevel.__init__(self)
        #self.geometry("800x600")
        self.title("ALMACÉN")
        self.resizable(False, False)

        ######## contenedor ARRIBA
        self.frame = Frame(self)
        self.frame.grid()

        ##### CONTENEDOR IZQUIERDA / busqueda
        self.frame1 = Frame(self.frame)
        self.frame1.grid(row=1, column=1)

        #self.label_title1=Label(self.frame1,text="ALMACEN ")
        #self.label_title1.grid(row=0,sticky=W+E)

        #area de búsqueda
        self.barra_busqueda = LabelFrame(self.frame1,
                                         text='Búsqueda',
                                         width=290,
                                         height=150)
        self.barra_busqueda.grid_propagate(False)
        self.barra_busqueda.grid(row=1, column=1, padx=40, pady=10)

        self.label_busqueda = Label(self.barra_busqueda, text='Buscar libro')
        self.label_busqueda.grid(row=1, column=1, padx=5, pady=5)

        #opciones
        OPCIONESB = ["General", "Autor", "Nombre", "Editorial"]
        #
        self.variable = StringVar(self.barra_busqueda)
        self.variable.set("Buscar por")

        self.opciones = OptionMenu(self.barra_busqueda, self.variable,
                                   *OPCIONESB)
        self.opciones.grid(row=1, column=2)

        self.texto_busqueda = Entry(self.barra_busqueda)
        self.texto_busqueda.grid(row=2,
                                 column=1,
                                 columnspan=2,
                                 sticky=W + E,
                                 padx=5,
                                 pady=5)

        self.boton_buscar = Button(self.barra_busqueda,
                                   text='Buscar',
                                   command=self.buscar)
        self.boton_buscar.grid(row=3,
                               column=1,
                               columnspan=2,
                               sticky=W + E,
                               padx=5,
                               pady=5)

        ###### CONTENEDOR DERECHA / botones
        self.frame3 = Frame(self.frame)
        self.frame3.grid(row=1, column=2)

        self.opciones = LabelFrame(self.frame3,
                                   text='Opciones mostrar todo',
                                   width=290,
                                   height=150)
        self.opciones.grid_propagate(False)
        self.opciones.pack()

        #mostrar todo
        self.boton_mostrar = Button(self.opciones,
                                    text='Mostrar todo',
                                    command=self.mostrar_libros)
        self.boton_mostrar.grid(row=0,
                                column=1,
                                columnspan=3,
                                sticky=W + E,
                                padx=5,
                                pady=5)

        #ordenar
        self.label_ordenar = Label(self.opciones, text='Ordenar por')
        self.label_ordenar.grid(row=1, column=1, sticky=E, padx=5, pady=5)

        self.seleccion = IntVar()

        self.opcion_autor = Radiobutton(self.opciones,
                                        text='autor',
                                        var=self.seleccion,
                                        value=1)
        self.opcion_autor.grid(row=1, column=2)

        self.opcion_nombre = Radiobutton(self.opciones,
                                         text='nombre',
                                         var=self.seleccion,
                                         value=2)
        self.opcion_nombre.grid(row=1, column=3)

        self.opcion_editorial = Radiobutton(self.opciones,
                                            text='editorial',
                                            var=self.seleccion,
                                            value=3)
        self.opcion_editorial.grid(row=2, column=2)

        self.opcion_precio = Radiobutton(self.opciones,
                                         text='precio',
                                         var=self.seleccion,
                                         value=4)
        self.opcion_precio.grid(row=2, column=3)

        self.boton_ordenar = Button(self.opciones,
                                    text='Ordenar',
                                    command=self.ordenar)
        self.boton_ordenar.grid(row=3,
                                column=1,
                                columnspan=3,
                                sticky=W + E,
                                padx=5,
                                pady=5)

        ##### CONTENEDOR ABAJO / libros
        self.frame2 = Frame(self)
        self.frame2.grid()

        self.libros = LabelFrame(self.frame2, text='Libros')
        self.libros.grid()

        #botones
        self.boton_vender = Button(self.libros,
                                   text='Vender',
                                   command=self.vender)
        self.boton_vender.grid(row=1, column=1)

        self.boton_borrar = Button(self.libros,
                                   text='Borrar',
                                   command=self.borrar)
        self.boton_borrar.grid(row=1, column=2)

        #self.boton_editar=Button(self.libros,text='Editar',command=self.editar)
        #self.boton_editar.grid(row=1,column=3)

        #espacio para mostrar libros
        self.tabla = ttk.Treeview(self.libros,
                                  columns=('Código', 'Nombre del libro',
                                           'Autor', 'Año', 'Editorial',
                                           'Precio', 'Cantidad'))

        self.tabla.heading('#0', text="", anchor='w')
        self.tabla.column('#0', anchor='center', width=5, stretch=NO)

        self.tabla.heading('#1', text='Código', anchor="w")
        self.tabla.column('#1', anchor='center', width=80)

        self.tabla.heading('#2', text='Nombre del libro', anchor=CENTER)
        self.tabla.column('#2', anchor='center', width=230)

        self.tabla.heading('#3', text='Autor', anchor=CENTER)
        self.tabla.column('#3', anchor='center', width=180)

        self.tabla.heading('#4', text='Año', anchor=CENTER)
        self.tabla.column('#4', anchor='center', width=50)

        self.tabla.heading('#5', text='Editorial', anchor=CENTER)
        self.tabla.column('#5', anchor='center', width=90)

        self.tabla.heading('#6', text='Precio', anchor=CENTER)
        self.tabla.column('#6', anchor='center', width=60)

        self.tabla.heading('#7', text='Cantidad', anchor=CENTER)
        self.tabla.column('#7', anchor='center', width=60)

        self.tabla.grid(row=2, column=1, columnspan=3)
示例#19
0
def matches_schedule(league_code, league_name):
    clearWindow()

    canvas = tk.Canvas(window, width=600, height=600)
    canvas.pack()
    if league_name == "Premier League":
        background = ImageTk.PhotoImage(Image.open("assets/bgprem.png"))
    elif league_name == "LaLiga":
        background = ImageTk.PhotoImage(Image.open("assets/bglaliga.png"))
    elif league_name == "Bundesliga":
        background = ImageTk.PhotoImage(Image.open("assets/bgbundes.png"))
    else:
        background = ImageTk.PhotoImage(Image.open("assets/bgserie.png"))
    canvas.background = background
    canvas.create_image(0, 0, image=background, anchor=NW)

    buttonReturn = tk.Button(text="<- Wróć do lig",
                             width=20,
                             font=("Russo One", 10),
                             command=matches)
    buttonReturn_window = canvas.create_window(80,
                                               15,
                                               anchor=N,
                                               window=buttonReturn)

    info_text = canvas.create_text(300,
                                   30,
                                   anchor=N,
                                   font=("Russo One", 20),
                                   fill="black",
                                   text=league_name)

    today = date.today()
    today = today.strftime("%d.%m.%Y")

    date_text = canvas.create_text(180,
                                   80,
                                   anchor=N,
                                   font=("Russo One", 20),
                                   fill="black",
                                   text="Data: " + today)

    time = strftime('%H:%M')
    time_text = canvas.create_text(420,
                                   80,
                                   anchor=N,
                                   font=("Russo One", 20),
                                   fill="black",
                                   text="Godzina: " + time)

    matches_data = api.matches_today(league_code)
    if matches_data == {}:
        msg = canvas.create_text(300,
                                 200,
                                 anchor=N,
                                 font=("Russo One", 20),
                                 fill="black",
                                 text="Brak meczów w tym dniu")
    else:
        tableFrame = Frame(window)
        tableFrame.pack()

        frame_window = canvas.create_window(300, 330, window=tableFrame)

        tableContent = ttk.Treeview(tableFrame,
                                    columns=(1, 2),
                                    show="headings",
                                    height="20")
        tableContent.pack()

        tableContent.heading(1, text="Mecz")
        tableContent.column(1, minwidth=0, width=300)
        tableContent.heading(2, text="Godzina")
        tableContent.column(2, minwidth=0, width=100)

        for k, v in matches_data.items():
            tableContent.insert('', 'end', values=(k, v))
示例#20
0
    def create_widgets(self):
        """ Create all the widgets in the window. See design notes for details """
        logging.debug("Creaing Recipe Widgets")
        #Recipe list on the left, as a tree
        self.recipeList = ttk.Treeview(self)
        self.recipeList.pack(side="left")
        #get all the recipes
        theRecipes = self.recipes.getRecipeNames()
        #add them to the treeview
        for i, recipeName in enumerate(sorted(theRecipes)):
            logging.info("Making button for: {}".format(recipeName))
            #CORE UPDATE ACTION:
            newEntry = self.recipeList.insert('', i)
            self.recipeList.item(newEntry, text=recipeName)
        #bind the update function to the treeview:
        self.recipeList.bind(TREEVIEW_ACTION, self.display_recipe_listener)

        #Separate the Recipe List from the Recipe display:
        ttk.Separator(self, orient=tk.VERTICAL).pack(side="left",
                                                     fill=tk.Y,
                                                     expand=True)

        #Recipe Frame:
        self.recipeFrame = tk.Frame(self)
        self.recipeFrame.pack(side="right")

        #Recipe Title
        self.recipeLabel = tk.Label(self.recipeFrame, borderwidth=5)
        self.recipeLabel.grid(row=0, column=1)

        ttk.Separator(self.recipeFrame,
                      orient=tk.HORIZONTAL).grid(row=1,
                                                 column=0,
                                                 columnspan=3,
                                                 sticky=tk.E + tk.W)
        ingredientLabel = tk.Label(self.recipeFrame, borderwidth=5)
        ingredientLabel['text'] = "INGREDIENTS"
        ingredientLabel.grid(row=2, column=0)

        instructionLabel = tk.Label(self.recipeFrame, borderwidth=5)
        instructionLabel['text'] = "INSTRUCTIONS"
        instructionLabel.grid(row=2, column=2)

        #separate title from the rest
        ttk.Separator(self.recipeFrame,
                      orient=tk.HORIZONTAL).grid(row=3,
                                                 column=0,
                                                 columnspan=3,
                                                 sticky=tk.E + tk.W)
        #Separate the Ingredients (column 0) from the instructions (column 2)
        ttk.Separator(self.recipeFrame,
                      orient=tk.VERTICAL).grid(row=3,
                                               column=1,
                                               rowspan=4,
                                               sticky=tk.N + tk.S)

        #CORE DISPLAYS:
        #recipe ingredients
        self.recipeIngredients = tk.Label(self.recipeFrame,
                                          width=DEFAULT_LABEL_SIZE,
                                          height=DEFAULT_LABEL_SIZE,
                                          padx=DEFAULT_LABEL_SIZE,
                                          pady=DEFAULT_LABEL_SIZE)
        self.recipeIngredients.grid(row=4, column=0)
        self.recipeIngredients['text'] = EMPTY_LABEL_TEXT

        #recipe instructions
        self.recipeInstructions = tk.Label(self.recipeFrame,
                                           width=DEFAULT_LABEL_SIZE,
                                           height=DEFAULT_LABEL_SIZE,
                                           padx=DEFAULT_LABEL_SIZE,
                                           pady=DEFAULT_LABEL_SIZE)
        self.recipeInstructions.grid(row=4, column=2)
        self.recipeIngredients['text'] = EMPTY_LABEL_TEXT
示例#21
0
    def result_ui(self, mainframe, ac):  ##进行结果展示
        self.little_win = mainframe
        target = self.par_traindatavariable_setting[
            self.par_traindatavariable_setting["变量角色"] == '目标'][0]
        target = list(self.par_traindatavariable_setting[
            self.par_traindatavariable_setting['变量角色'] == '目标']['变量名称'])[0]
        t_data = {
            "data":
            '原始数据集',
            "obs":
            self.par_train_data[target].count(),
            "bad_num":
            self.par_train_data[target].sum(),
            "bad_rate":
            str(round(self.par_train_data[target].mean() * 100, 2)) + '%'
        }
        t_trian_data = {
            "data":
            '训练数据集',
            "obs":
            self.trainpart_data[target].count(),
            "bad_num":
            self.trainpart_data[target].sum(),
            "bad_rate":
            str(round(self.trainpart_data[target].mean() * 100, 2)) + '%'
        }
        t_valid_data = {
            "data":
            '验证数据集',
            "obs":
            self.validpart_data[target].count(),
            "bad_num":
            self.validpart_data[target].sum(),
            "bad_rate":
            str(round(self.validpart_data[target].mean() * 100, 2)) + '%'
        }
        data_list = [t_data, t_trian_data, t_valid_data]

        if ac != 're':
            self.button_result_save = ttk.Button(self.little_win, text='保存 确认')
            self.button_result_save.grid(column=0,
                                         row=0,
                                         sticky=(W),
                                         padx=10,
                                         pady=10)
            self.button_result_save.bind("<Button-1>", self.save_data)

            self.button_reset = ttk.Button(self.little_win, text='重新分区')
            self.button_reset.grid(column=3,
                                   row=0,
                                   sticky=(W),
                                   padx=10,
                                   pady=10)
            self.button_reset.bind("<Button-1>", self.all_reset)

        summ = LabelFrame(self.little_win, text="分区结果", width=20, height=20)
        tree = ttk.Treeview(summ,
                            columns=["data", 'obs', 'bad_num', 'bad_rate'],
                            show="headings",
                            selectmode=tk.BROWSE)
        tree.column("data",
                    width=80,
                    minwidth=80,
                    stretch=tk.NO,
                    anchor="center")
        tree.column("obs",
                    width=80,
                    minwidth=80,
                    stretch=tk.NO,
                    anchor="center")
        tree.column("bad_num",
                    width=80,
                    minwidth=80,
                    stretch=tk.NO,
                    anchor="center")
        tree.column("bad_rate",
                    width=80,
                    minwidth=80,
                    stretch=tk.NO,
                    anchor="center")
        tree.heading("data", text="数据集")
        tree.heading("obs", text="样本数")
        tree.heading("bad_num", text="坏客户数")
        tree.heading("bad_rate", text="坏账率")

        i = 0
        for da in data_list:
            tree.insert('',
                        i,
                        values=(da.get("data"), da.get("obs"),
                                da.get("bad_num"), da.get("bad_rate")))
            i += 1
        tree.grid()
        summ.grid(column=0, row=1, columnspan=4, padx=8, pady=8)

        ##图形
        la = LabelFrame(self.little_win, text='总样本分布')
        t = set(self.trainpart_data.index)
        t1 = set(self.validpart_data.index)
        t2 = set(self.par_train_data.index)
        g = plt.figure(figsize=(4, 4))
        pp = venn3(subsets=[t, t1, t2],
                   set_labels=('train', 'valid', 'total'),
                   set_colors=('r', 'b', 'g'))
        canvas = FigureCanvasTkAgg(g, master=la)
        canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        la.grid(column=4, row=1, columnspan=4, padx=8, pady=8)

        good = LabelFrame(self.little_win, text='好样本分布', width=20, height=20)
        tg = set(self.trainpart_data[self.trainpart_data[target] == 0].index)
        tg1 = set(self.validpart_data[self.validpart_data[target] == 0].index)
        tg2 = set(self.par_train_data[self.par_train_data[target] == 0].index)
        gg = plt.figure(figsize=(4, 4))
        pp = venn3(subsets=[tg, tg1, tg2],
                   set_labels=('train', 'valid', 'total'),
                   set_colors=('r', 'b', 'g'))
        canvasg = FigureCanvasTkAgg(gg, good)
        canvasg.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        canvasg._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        good.grid(column=0, row=2, columnspan=4, padx=8, pady=8)

        bad = LabelFrame(self.little_win, text='坏样本分布', width=20, height=20)
        tg = set(self.trainpart_data[self.trainpart_data[target] == 1].index)
        tg1 = set(self.validpart_data[self.validpart_data[target] == 1].index)
        tg2 = set(self.par_train_data[self.par_train_data[target] == 1].index)
        gg = plt.figure(figsize=(4, 4))
        pp = venn3(subsets=[tg, tg1, tg2],
                   set_labels=('train', 'valid', 'total'),
                   set_colors=('r', 'b', 'g'))
        canvasg = FigureCanvasTkAgg(gg, bad)
        canvasg.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        canvasg._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        bad.grid(column=4, row=2, columnspan=4, padx=8, pady=8)
             relief='raised',
             bg='grey')
menu.pack(side=BOTTOM)
menu.grid_propagate(0)
menu.pack_propagate(0)

# Display window for Orders
style = ttk.Style()
style.configure("Treeview",
                highlightthickness=0,
                bd=10,
                font=('Garamond', 21, 'bold'),
                rowheight=45)  # Modify the font of the body
style.configure("Treeview.Heading", font=('Times New Roman', 25, 'bold'))
kitchen = ttk.Treeview(menu,
                       columns=("Index", "Table", "Order", "Qty", "Status"),
                       height=29,
                       selectmode='browse')
kitchen["displaycolumns"] = ("Table", "Order", "Qty", "Status"
                             )  # ________________HIDES INDEX COLUMN
kitchen['show'] = 'headings'
kitchen.pack()
kitchen.pack_propagate(0)
kitchen.column("0", width=220, anchor='n')
kitchen.column("1", width=220, anchor='n')
kitchen.column("2", width=500, anchor='w')
kitchen.column("3", width=215, anchor='n')
kitchen.column("4", width=200, anchor='n')
kitchen.heading("1", text="Table")
kitchen.heading("2", text="Order")
kitchen.heading("3", text="Qty")
kitchen.heading("4", text="Status")
    def __init__(self, root):
        self.root = root
        self.root.title("EMPLOYEE SYSTEM")
        self.root.geometry("1350x750+0+0")
        self.root.config(background="white")

        # --------------------------------FRAME DEPARTMENT------------------------------#
        MainFrame = Frame(self.root)
        MainFrame.grid()

        self.db = Backend.database.DBConnect()
        TopFrame = Frame(MainFrame,
                         bd=14,
                         width=1350,
                         height=550,
                         padx=20,
                         relief=RIDGE,
                         bg="maroon")
        TopFrame.pack(side=TOP)
        title = Label(TopFrame,
                      text=" EMPLOYEE SYSTEM",
                      font=("helvetica", 20)).place(x=4, y=3)

        LeftFrame = Frame(TopFrame,
                          bd=10,
                          width=450,
                          height=700,
                          padx=2,
                          relief=RIDGE,
                          bg="gray")
        LeftFrame.pack(side=LEFT)

        RightFrame = Frame(TopFrame,
                           bd=10,
                           width=820,
                           height=700,
                           padx=2,
                           relief=RIDGE,
                           bg="black")
        RightFrame.pack(side=RIGHT)

        BottomFrame = Frame(MainFrame,
                            bd=10,
                            width=1350,
                            height=150,
                            padx=20,
                            relief=RIDGE,
                            bg="black")
        BottomFrame.pack(side=BOTTOM)

        # ---------------------------------BUTTON FUNNCTION DEPARTMENT---------------------------#
        def iExit():
            iExit = messagebox.askyesno("Confirm if you want to exit!")
            if iExit > 0:
                root.destroy()
                return

        def Reset():
            self.Employee_Ref.set("")
            self.Name.set("")
            self.Address.set("")
            self.Mobile.set("")
            self.Gender.set("")

        # ---------------------------VARIABLES ----------------------#

        self.Employee_Ref = StringVar()
        self.Name = StringVar()
        self.Address = StringVar()
        self.Mobile = StringVar()
        self.IDtype = StringVar()
        self.Gender = StringVar()
        self.search = StringVar()
        self.searchtxt = StringVar()
        self.sort = StringVar()

        # ------------------------------------LEFT FRAME--------------------------#
        self.lblEmployee_Ref = Label(LeftFrame,
                                     font=("arial", 12, "bold"),
                                     text="Employee Ref",
                                     padx=2,
                                     pady=2,
                                     bg="gray")
        self.lblEmployee_Ref.grid(row=0, column=0, sticky=W)
        self.txtEmployee_Ref = Entry(LeftFrame,
                                     font=("arial", 12, "bold"),
                                     textvariable=self.Employee_Ref,
                                     width=20)
        self.txtEmployee_Ref.grid(row=0, column=1, pady=3, padx=20)

        self.lblName = Label(LeftFrame,
                             font=("arial", 12, "bold"),
                             text="Name",
                             padx=2,
                             pady=2,
                             bg="gray")
        self.lblName.grid(row=1, column=0, sticky=W)
        self.txtName = Entry(LeftFrame,
                             font=("arial", 12, "bold"),
                             textvariable=self.Name,
                             width=20)
        self.txtName.grid(row=1, column=1, pady=3, padx=20)

        self.lblAddress = Label(LeftFrame,
                                font=("arial", 12, "bold"),
                                text="Address",
                                padx=2,
                                pady=2,
                                bg="gray")
        self.lblAddress.grid(row=3, column=0, sticky=W)
        self.txtAddress = Entry(LeftFrame,
                                font=("arial", 12, "bold"),
                                textvariable=self.Address,
                                width=20)
        self.txtAddress.grid(row=3, column=1, pady=3, padx=20)

        self.lblMobile = Label(LeftFrame,
                               font=("arial", 12, "bold"),
                               text="Mobile",
                               padx=2,
                               pady=2,
                               bg="gray")
        self.lblMobile.grid(row=5, column=0, sticky=W)
        self.txtMobile = Entry(LeftFrame,
                               font=("arial", 12, "bold"),
                               textvariable=self.Mobile,
                               width=20)
        self.txtMobile.grid(row=5, column=1, pady=3, padx=20)

        self.lblGender = Label(LeftFrame,
                               font=("arial", 12, "bold"),
                               text="Gender",
                               padx=2,
                               pady=2,
                               bg="gray")
        self.lblGender.grid(row=10, column=0, sticky=W)
        self.cboGender = ttk.Combobox(LeftFrame,
                                      textvariable=self.Gender,
                                      state="read only",
                                      font=("arial", 12, "bold"),
                                      width=18)
        self.cboGender["value"] = ("", "Male", "Female", "Any Other")
        self.cboGender.current(0)
        self.cboGender.grid(row=10, column=1, pady=3, padx=20)

        # ---------------------------RIGHT FRAME-----------------------------------#
        self.tableframe = Frame(RightFrame,
                                height=350,
                                width=900,
                                bd=5,
                                bg="black")
        self.tableframe.grid(row=1, column=0, columnspan=2, padx=2, pady=3)
        Table_Frame = Frame(RightFrame, bd=4, relief=RIDGE, bg="black")
        Table_Frame.place(x=2, y=3, width=900, height=320)
        scroll_x = Scrollbar(Table_Frame, orient=HORIZONTAL)
        scroll_y = Scrollbar(Table_Frame, orient=VERTICAL)
        self.hotel_table = ttk.Treeview(Table_Frame,
                                        columns=("Employee ref", "Name",
                                                 "Address", "Mobile",
                                                 "Gender"),
                                        xscrollcommand=scroll_x.set,
                                        yscrollcommand=scroll_y.set)
        scroll_x.pack(side=BOTTOM, fill=X)
        scroll_y.pack(side=RIGHT, fill=Y)
        scroll_x.config(command=self.hotel_table.xview)
        scroll_y.config(command=self.hotel_table.yview)
        self.hotel_table.heading("Employee ref", text="Employeeref")
        self.hotel_table.heading("Name", text="Name")
        self.hotel_table.heading("Address", text="Address")
        self.hotel_table.heading("Mobile", text="Mobile")
        self.hotel_table.heading("Gender", text="Gender")

        self.hotel_table['show'] = 'headings'
        self.hotel_table.column("Employee ref", width=30)
        self.hotel_table.column("Name", width=30)
        self.hotel_table.column("Address", width=30)
        self.hotel_table.column("Mobile", width=30)
        self.hotel_table.column("Gender", width=30)

        self.hotel_table.pack(fill=BOTH, expand=0.5)
        self.fetch_data()
        self.hotel_table.bind("<ButtonRelease-1>", self.cursor)

        self.searchby = Label(RightFrame,
                              padx=10,
                              pady=1,
                              bd=4,
                              fg="black",
                              font=("arial", 10, "bold"),
                              width=10,
                              height=1,
                              bg="sky blue",
                              cursor="hand2",
                              text="Search By").grid(row=4, column=0, padx=5)
        self.cboSearch = ttk.Combobox(RightFrame,
                                      textvariable=self.search,
                                      state="read only",
                                      font=("arial", 12, "bold"),
                                      width=18)
        self.cboSearch["value"] = ("", " Employee_ref", "Mobile")
        self.cboSearch.current(0)
        self.cboSearch.grid(row=5, column=0, pady=3, padx=15)
        self.txtSearch = Entry(RightFrame,
                               font=("arial", 12, "bold"),
                               width=20,
                               textvariable=self.searchtxt)
        self.txtSearch.grid(row=4, column=1, pady=3, padx=20)

        self.sortby = Label(RightFrame,
                            padx=10,
                            pady=1,
                            bd=4,
                            fg="black",
                            font=("arial", 10, "bold"),
                            width=10,
                            height=1,
                            bg="sky blue",
                            cursor="hand2",
                            text="Sort By").grid(row=7, column=0, padx=5)
        self.cboSort = ttk.Combobox(RightFrame,
                                    textvariable=self.sort,
                                    state="read only",
                                    font=("arial", 12, "bold"),
                                    width=18)
        self.cboSort["value"] = ("", "Employee_Ref", "Name")
        self.cboSort.current(0)
        self.cboSort.grid(row=8, column=0, pady=3, padx=15)
        self.txtShowall = Button(RightFrame,
                                 text="Show all",
                                 font=("arial", 12, "bold"),
                                 bg="skyblue",
                                 width=20,
                                 cursor="hand2",
                                 command=self.showall)
        self.txtShowall.grid(row=7, column=1, pady=3, padx=20)

        # ---------------------------BUTTON DEPARTMENT-----------------------------#

        self.btnReset = Button(BottomFrame,
                               padx=16,
                               pady=1,
                               bd=4,
                               fg="black",
                               font=("arial", 13, "bold"),
                               width=10,
                               height=2,
                               bg="skyblue",
                               cursor="hand2",
                               text="Reset",
                               command=Reset).grid(row=0, column=6, padx=5)

        self.btnExit = Button(BottomFrame,
                              padx=16,
                              pady=1,
                              bd=4,
                              fg="black",
                              font=("arial", 13, "bold"),
                              width=10,
                              height=2,
                              bg="skyblue",
                              cursor="hand2",
                              text="Exit",
                              command=iExit).grid(row=0, column=7, padx=5)

        self.btnSearch = Button(BottomFrame,
                                padx=16,
                                pady=1,
                                bd=4,
                                fg="black",
                                font=("arial", 13, "bold"),
                                width=10,
                                height=2,
                                bg="cadetblue",
                                cursor="hand2",
                                text="Search",
                                command=self.search_data).grid(row=0,
                                                               column=8,
                                                               padx=5)

        self.btnSort = Button(BottomFrame,
                              padx=16,
                              pady=1,
                              bd=4,
                              fg="black",
                              font=("arial", 13, "bold"),
                              width=10,
                              height=2,
                              bg="cadet blue",
                              cursor="hand2",
                              text="Sort",
                              command=self.sorted).grid(row=0,
                                                        column=9,
                                                        padx=5)
        self.btnDelete = Button(TopFrame,
                                padx=10,
                                pady=1,
                                bd=4,
                                fg="black",
                                font=("arial", 10, "bold"),
                                width=7,
                                height=1,
                                bg="cadet blue",
                                cursor="hand2",
                                text="Delete",
                                command=self.delete).place(x=100, y=350)
        self.btnAdd = Button(TopFrame,
                             padx=10,
                             pady=1,
                             bd=4,
                             fg="black",
                             font=("arial", 10, "bold"),
                             width=7,
                             height=1,
                             bg="cadet blue",
                             cursor="hand2",
                             text="Add",
                             command=self.adddata).place(x=0, y=350)
        self.btnUpdate = Button(TopFrame,
                                padx=10,
                                pady=1,
                                bd=4,
                                fg="black",
                                font=("arial", 10, "bold"),
                                width=7,
                                height=1,
                                bg="cadet blue",
                                cursor="hand2",
                                text="Update",
                                command=self.update).place(x=200, y=350)
示例#24
0
    def GuiShow(self):

        self.topWin = tk.Toplevel()
        self.topWin.title('Menu')
        width = 640
        height = 500

        dx = self.wparent.winfo_x()
        dy = self.wparent.winfo_y()
        self.topWin.geometry("%dx%d+%d+%d" % (width, height, dx, dy))
        self.topWin.minsize(width, height)
        self.topWin.maxsize(width, height)
        #self.topWin.wm_attributes('-type', 'splash')

        self.topWin.protocol('WM_DELETE_WINDOW',
                             lambda: self.CallBack(self.topWin))

        frame = tk.Frame(self.topWin)
        frame.pack(fill=tk.BOTH, expand=True)

        #-------------------------- topWin ----------------------------

        frame_left1 = tk.Frame(frame, highlightthickness = 1, highlightbackground = 'gray'\
                               , bg = 'white', width = 150)
        frame_left1.pack(side=tk.LEFT, fill=tk.BOTH, padx=5, pady=5)
        frame_left1.propagate(
            False
        )  #Setting to True means that the geometry of the parent component is determined by the child component (the default) and vice versa

        frame_left2 = tk.Frame(frame, highlightthickness = 1, highlightbackground = 'gray'\
                               , highlightcolor = 'gray', bg = 'white', )
        frame_left2.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, pady=5)

        #-------------------------- frame_left1 ( function menu )----------------------------

        self.labels = []
        options = [' Management', ' New face', ' Change permission']
        for item in options:
            label_left = tk.Label(frame_left1,
                                  text=item,
                                  bg='white',
                                  anchor=tk.W)
            label_left.pack(fill=tk.X)
            label_left.bind(
                '<Button-1>',
                self.handlerAdaptor(self.lbChangeBackGround,
                                    index=options.index(item)))
            self.labels.append(label_left)
        self.labels[0].config(bg='deepskyblue')

        #-------------------------- frame_left2 ----------------------------

        self.listFrames = []

        frame_left2_1 = tk.Frame(frame_left2, bg='white', padx=5, pady=5)
        frame_left2_1.propagate(False)
        frame_left2_1.pack(fill=tk.BOTH, expand=True)
        self.listFrames.append(frame_left2_1)

        frame_left2_2 = tk.Frame(frame_left2, bg='white', padx=5, pady=5)
        frame_left2_2.propagate(False)
        self.listFrames.append(frame_left2_2)

        frame_left2_3 = tk.Frame(frame_left2, bg='white', padx=5, pady=5)
        frame_left2_3.propagate(False)
        self.listFrames.append(frame_left2_3)

        #-------------------------- frame_left2_1 ( face list )----------------------------
        frame_left2_1_1 = tk.Frame(frame_left2_1)
        frame_left2_1_1.pack(fill=tk.BOTH, expand=True)
        s = ttk.Style()
        s.configure('Treeview', rowheight=25)

        self.table = ttk.Treeview(frame_left2_1_1,
                                  show='headings',
                                  selectmode='extended')
        self.table.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
        self.table.config(columns=('label', 'name', 'identity', 'note'))
        self.table.heading('label', text='label')
        self.table.column('label', width='20')
        self.table.heading('name', text='name')
        self.table.column('name', width='10')
        self.table.heading('identity', text='identity')
        self.table.column('identity', width='20')
        self.table.heading('note', text='note')
        self.table.column('note', width='30')
        #self.table['show'] = 'headings'
        #self.table.column("#0", width = 0)

        scrollbar = ttk.Scrollbar(frame_left2_1_1)
        scrollbar.pack(side=tk.LEFT, fill=tk.Y)
        scrollbar.config(command=self.table.yview)
        self.table.config(yscrollcommand=scrollbar.set)

        serch_frame = tk.Frame(frame_left2_1, bg='white')
        serch_frame.pack(fill=tk.X)
        serch_frame.config(pady=5)
        serchlabel = tk.Label(serch_frame,
                              text='Serch: ',
                              anchor=tk.E,
                              bg='white')
        serchlabel.pack(side=tk.LEFT)
        vcmd = self.topWin.register(self.SerchByIdentity)
        serchentry = tk.Entry(serch_frame,
                              validate="key",
                              validatecommand=(vcmd, '%P'),
                              highlightcolor='deepskyblue')
        serchentry.pack(side=tk.RIGHT, fill=tk.X, expand=True)



        button_frame = tk.Frame(frame_left2_1, height = 40, bg = 'white', pady = 2\
                                , highlightthickness = 1, highlightbackground = 'gray')
        #button_frame.propagate(False)
        button_frame.pack(fill=tk.X)

        button_f1 = tk.Button(button_frame,
                              text='Cancel',
                              command=self.UnSelectTable)
        button_f1.pack(side=tk.RIGHT, padx=2)
        button_f2 = tk.Button(button_frame,
                              text='Delete',
                              command=self.DeleteTableItems)
        button_f2.pack(side=tk.RIGHT, padx=2)
        button_f3 = tk.Button(button_frame,
                              text='Delete all',
                              command=lambda: self.DeleteTableItems(True))
        button_f3.pack(side=tk.RIGHT, padx=2)

        #fill the table
        self.RefreshTable()

        #-------------------------- frame_left2_2 ( new face )----------------------------

        fram_2_2_base1 = tk.Frame(frame_left2_2, bg = 'white'\
                                   ,highlightthickness = 1, highlightbackground = 'gray', highlightcolor = 'gray')
        fram_2_2_base1.propagate(False)
        fram_2_2_base1.pack(fill=tk.BOTH, expand=True)
        frame_2_2_base = tk.Frame(fram_2_2_base1, bg = 'white', width = 350, height = 400, pady = 20\
                                  ,padx = 50)
        frame_2_2_base.propagate(False)
        frame_2_2_base.pack()

        frame_2_2_1 = tk.Frame(frame_2_2_base, bg='white')
        #frame_2_2_1.propagate(False)
        frame_2_2_1.pack(fill=tk.X, pady=10)
        self.inputText1 = tk.Entry(frame_2_2_1, highlightcolor='deepskyblue')
        self.inputText1.pack(side=tk.RIGHT)
        labelText1 = tk.Label(frame_2_2_1,
                              bg='white',
                              text='Name: ',
                              anchor=tk.E)
        labelText1.pack(side=tk.RIGHT)

        frame_2_2_1 = tk.Frame(frame_2_2_base, bg='white')
        #frame_2_2_1.propagate(False)
        frame_2_2_1.pack(fill=tk.X, pady=10)
        self.inputText2 = tk.Entry(frame_2_2_1, highlightcolor='deepskyblue')
        self.inputText2.pack(side=tk.RIGHT)
        labelText2 = tk.Label(frame_2_2_1,
                              bg='white',
                              text='Identity: ',
                              anchor=tk.E)
        labelText2.pack(side=tk.RIGHT)

        frame_2_2_2 = tk.Frame(frame_2_2_base, bg='white')
        #frame_2_2_2.propagate(False)
        frame_2_2_2.pack(fill=tk.X, pady=10)
        self.inputText3 = tk.Text(frame_2_2_2,
                                  width=20,
                                  height=5,
                                  wrap=tk.WORD,
                                  highlightcolor='deepskyblue')
        self.inputText3.pack(side=tk.RIGHT)
        labelText3 = tk.Label(frame_2_2_2,
                              bg='white',
                              text='Note: ',
                              anchor=tk.NE)
        labelText3.pack(side=tk.RIGHT, fill=tk.Y)

        frame_2_2_base2 = tk.Frame(frame_left2_2, bg = 'white', pady = 2\
                                   ,highlightthickness = 1, highlightbackground = 'gray')
        #frame_2_2_4.propagate(False)
        frame_2_2_base2.pack(side=tk.BOTTOM, fill=tk.X, pady=5)
        button_f21 = tk.Button(frame_2_2_base2,
                               text='Clear',
                               command=self.ClearFaceInput)
        button_f21.pack(side=tk.RIGHT, padx=2)
        # =============================================================================
        #
        #         button_f22 = tk.Button(frame_2_2_base2, text = 'Train', width = 5, command = lambda:MyThread(self.CreateNewFaceTest).start() )
        # =============================================================================
        button_f22 = tk.Button(
            frame_2_2_base2,
            text='Train',
            width=5,
            command=lambda: MyThread(self.CreateNewFace).start())
        button_f22.pack(side=tk.RIGHT, padx=2)
        # =============================================================================
        #         button_f22 = tk.Button(frame_2_2_base2, text = 'Train', width = 5, command = self.CreateNewFace)
        #         button_f22.pack(side = tk.RIGHT, padx = 2)
        # =============================================================================
        button_f23 = tk.Button(frame_2_2_base2,
                               text='Trainfromfile',
                               width=10,
                               command=self.CreatNewFaceFromFile)
        button_f23.pack(side=tk.LEFT, padx=2)

        #-------------------------- frame_left2_3 (change permission)----------------------------

        frame_2_3_base1 = tk.Frame(frame_left2_3, bg = 'white'\
                                   ,highlightthickness = 1, highlightbackground = 'gray', highlightcolor = 'gray')
        frame_2_3_base1.propagate(False)
        frame_2_3_base1.pack(fill=tk.BOTH, expand=True)
        frame_2_3_base = tk.Frame(frame_2_3_base1,
                                  bg='white',
                                  width=300,
                                  height=400,
                                  pady=20)
        frame_2_3_base.propagate(False)
        frame_2_3_base.pack()

        frame_2_3_1 = tk.Frame(frame_2_3_base, bg='white')
        #frame_2_3_1.propagate(False)
        frame_2_3_1.pack(fill=tk.X, pady=10)
        self.inputTextOld = tk.Entry(frame_2_3_1,
                                     show='*',
                                     highlightcolor='deepskyblue')
        self.inputTextOld.pack(side=tk.RIGHT)
        labelText1 = tk.Label(frame_2_3_1,
                              bg='white',
                              text='old permission: ',
                              anchor=tk.E)
        labelText1.pack(side=tk.RIGHT)

        frame_2_3_2 = tk.Frame(frame_2_3_base, bg='white')
        #frame_2_3_2.propagate(False)
        frame_2_3_2.pack(fill=tk.X, pady=10)
        self.inputTextNew = tk.Entry(frame_2_3_2,
                                     show='*',
                                     highlightcolor='deepskyblue')
        self.inputTextNew.pack(side=tk.RIGHT)
        labelText1 = tk.Label(frame_2_3_2,
                              bg='white',
                              text='new permission: ',
                              anchor=tk.E)
        labelText1.pack(side=tk.RIGHT)

        frame_2_3_3 = tk.Frame(frame_2_3_base, bg='white')
        #frame_2_3_3.propagate(False)
        frame_2_3_3.pack(fill=tk.X, pady=10)
        self.inputTextRepeat = tk.Entry(frame_2_3_3,
                                        show='*',
                                        highlightcolor='deepskyblue')
        self.inputTextRepeat.pack(side=tk.RIGHT)
        labelText1 = tk.Label(frame_2_3_3,
                              bg='white',
                              text='repeat: ',
                              anchor=tk.E)
        labelText1.pack(side=tk.RIGHT)


        frame_2_3_base2 = tk.Frame(frame_left2_3, bg = 'white', pady = 2\
                                   ,highlightthickness = 1, highlightbackground = 'gray')
        #frame_2_2_4.propagate(False)
        frame_2_3_base2.pack(side=tk.BOTTOM, fill=tk.X, pady=5)
        button_f21 = tk.Button(frame_2_3_base2,
                               text='Cancel',
                               command=self.CancelResetPermission)
        button_f21.pack(side=tk.RIGHT, padx=2)
        button_f22 = tk.Button(frame_2_3_base2,
                               text='Change',
                               width=5,
                               command=self.ChangePermission)
        button_f22.pack(side=tk.RIGHT, padx=2)
示例#25
0
    # Function without 'with' (When user open the file, the program will error)
    # f = open('savedata.csv',newline='',encoding='utf-8')
    # fr = csv.reader(f)
    # f.close() #Must close the file before run again


# read_csv()
# rs = read_csv()
# print(rs)

#Table
L = ttk.Label(T2, text='ตารางแสดงผลลัพธ์ทั้งหมด', font=FONT1).pack(pady=20)

header = ['วัน-เวลา', 'รายการ', 'ค่าใช้จ่าย', 'จำนวน', 'รวม']
resulttable = ttk.Treeview(
    T2, columns=header, show='headings', height=20
)  # show headings is main topic as tabs | height is number of the list
resulttable.pack()
#Show table without header and fixed size

### Manual header defination
# resulttable.heading(header[0],text='header[0]')
# resulttable.heading(header[1],text='header[1]')
# resulttable.heading(header[2],text='header[2]')
# resulttable.heading(header[3],text='header[3]')
# resulttable.heading(header[4],text='header[4]')

### For loop header defination
# for i in range(len(header)):
# 	resulttable.heading(header[i],text='header[i]')
示例#26
0
    def __init__(self, root):
        super().__init__(root)

        self["padding"] = (7, 7, 9, 9)

        self.root = root
        self.fileStorage = self.root.fileStorage

        # file selection
        self.saveToVar = StringVar()
        self.saveToVar.set(True)
        self.fileStorageFrame = FileStorageFrame(self)
        self.fileStorageFrame.grid(column=1,
                                   row=0,
                                   columnspan=2,
                                   sticky=(N, S, E, W),
                                   pady=5,
                                   padx=2)

        # statusbar
        self.status = StringVar()

        self.statusBar = ttk.Label(self, textvariable=self.status)
        self.statusBar.grid(column=0, row=4, columnspan=2, sticky=(S, E, W))

        # control button
        self.process = ttk.Button(self,
                                  text="Control",
                                  command=self.controlFun)
        self.process.grid(column=2, row=4, sticky=E)
        self.process.state(["disabled"])

        # report
        self.reportFrame = ttk.LabelFrame(self, text="Report")
        self.reportFrame.grid(column=0,
                              row=0,
                              rowspan=4,
                              sticky=(N, S, E, W),
                              padx=5)
        self.reportFrame.columnconfigure(0, weight=1)
        self.reportFrame.rowconfigure(0, weight=1)

        self.upFrame = ttk.Frame(self.reportFrame)
        self.upFrame.grid(column=0, row=0, columnspan=2, sticky=(N, S, E, W))
        self.upFrame.columnconfigure(0, weight=1)
        self.upFrame.rowconfigure(0, weight=1)

        self.contentTree = ttk.Treeview(self.upFrame, selectmode="none")
        self.contentTree.grid(column=0, row=0, sticky=(N, S, E, W))
        self.contentTree["columns"] = ("description", "importance", "tag")
        self.contentTree.column("#0", width=250, anchor="w")
        self.contentTree.heading("#0",
                                 text="Problem",
                                 command=lambda: self.orderReport("name"))
        self.contentTree.column("description", width=200, anchor="e")
        self.contentTree.heading(
            "description",
            text="Description",
            command=lambda: self.orderReport("description"))
        self.contentTree.column("importance", width=60, anchor="e")
        self.contentTree.heading(
            "importance",
            text="Importance",
            command=lambda: self.orderReport("importance"))
        self.contentTree.column("tag", width=10, anchor="center")
        self.contentTree.heading("tag",
                                 text="Tag",
                                 command=lambda: self.orderReport("tag"))
        self.scrollbar = ttk.Scrollbar(self.upFrame,
                                       orient=VERTICAL,
                                       command=self.contentTree.yview)
        self.scrollbar.grid(column=1, row=0, sticky=(N, S, E))
        self.contentTree.configure(yscrollcommand=self.scrollbar.set)

        self.saveToFrame = SaveToFrame(self.reportFrame, label=False)
        self.saveToFrame.grid(column=0, row=1, sticky=(E, W))

        self.saveBut = ttk.Button(self.reportFrame,
                                  text="Save",
                                  command=self.saveFun)
        self.saveBut.grid(column=1, row=1, sticky=E, padx=2)

        self.controlReport = ControlReport(self)

        self.contentTree.tag_bind("file", "<Double-1>",
                                  lambda e: self.treeDoubleClick(e))
        self.contentTree.tag_bind("file", "<3>", lambda e: self.filePopUp(e))
        self.contentTree.tag_bind("ok", "<3>", lambda e: self.okPopUp(e))
        self.contentTree.tag_bind("control", "<3>",
                                  lambda e: self.controlPopUp(e))
        self.contentTree.tag_configure("comment", background=commentColor())

        # method selection frame
        self.controlFrame = ControlFrame(self)
        self.controlFrame.grid(column=1,
                               row=1,
                               columnspan=2,
                               sticky=(N, W),
                               padx=10,
                               pady=55)

        # time frame
        self.timeFrame = TimeFrame(self)
        self.timeFrame.grid(column=1,
                            row=2,
                            columnspan=2,
                            sticky=(N, W),
                            padx=10)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(2, weight=1)
示例#27
0
    def buildShowAnimalWindowAdmin(self, showAnimalWindowAdmin):

        # Title Label
        titleLabel = Label(showAnimalWindowAdmin,
                           text="Search Animals",
                           font="Verdana 16 bold ")
        titleLabel.grid(row=1, column=2, sticky=W + E)

        nameLabel = Label(showAnimalWindowAdmin, text="Name")
        nameLabel.grid(row=2, column=0)

        self.animalNameSV = StringVar()
        animalNameEntry = Entry(showAnimalWindowAdmin,
                                textvariable=self.animalNameSV,
                                width=20)
        animalNameEntry.grid(row=2, column=1)

        speciesLabel = Label(showAnimalWindowAdmin, text="Species")
        speciesLabel.grid(row=3, column=0)
        self.speciesNameSV = StringVar()
        speciesNameEntry = Entry(showAnimalWindowAdmin,
                                 textvariable=self.speciesNameSV,
                                 width=20)
        speciesNameEntry.grid(row=3, column=1)

        exhibitLabel = Label(showAnimalWindowAdmin, text="Exhibit")
        exhibitLabel.grid(row=4, column=0)
        exhibitDefault = StringVar()
        exhibitDefault.set("")
        exhibitMenu = OptionMenu(showAnimalWindowAdmin, exhibitDefault,
                                 "Pacific", "Jungle", "Sahara", "Mountainous",
                                 "Birds")
        exhibitMenu.grid(row=4, column=1)

        minLabel = Label(showAnimalWindowAdmin, text="Min")
        minLabel.grid(row=2, column=3, sticky=W)

        maxLabel = Label(showAnimalWindowAdmin, text="Max")
        maxLabel.grid(row=2, column=4, sticky=W)

        ageLabel = Label(showAnimalWindowAdmin, text="Age")
        ageLabel.grid(row=3, column=2)

        minSpinBox = Spinbox(showAnimalWindowAdmin, from_=0, to=10000)
        minSpinBox.grid(row=3, column=3, pady=10, sticky=W)

        maxSpinBox = Spinbox(showAnimalWindowAdmin, from_=0, to=10000)
        maxSpinBox.grid(row=3, column=4, pady=10, sticky=W)

        typeLabel = Label(showAnimalWindowAdmin, text="Type")
        typeLabel.grid(row=4, column=2)
        # Name Entry
        typeDefault = StringVar()
        typeDefault.set("mammal")
        typeMenu = OptionMenu(showAnimalWindowAdmin, typeDefault, "mammal",
                              "bird", "amphibian", "reptile", "fish",
                              "invertebrate")
        typeMenu.grid(row=4, column=3, sticky=W)

        selectAnimalTree = ttk.Treeview(showAnimalWindowAdmin,
                                        columns=("Name", "Size", "Exhibit",
                                                 "Age"))
        selectAnimalTree.heading('#0', text="Name")
        selectAnimalTree.heading('#1', text="Species")
        selectAnimalTree.heading('#2', text="Exhibit")
        selectAnimalTree.heading('#3', text="Age")
        selectAnimalTree.heading('#4', text="Type")
        selectAnimalTree.column('#0', width=150, anchor="center")
        selectAnimalTree.column('#1', width=150, anchor="center")
        selectAnimalTree.column('#2', width=150, anchor="center")
        selectAnimalTree.column('#3', width=150, anchor="center")
        selectAnimalTree.column('#4', width=150, anchor="center")
        selectAnimalTree.grid(row=5, columnspan=4, sticky='nsew')

        # Button
        findAnimalsButton = Button(
            showAnimalWindowAdmin,
            text="Find Animals",
            command=self.showAnimalWindowAdminFindAnimalsButtonClicked)
        findAnimalsButton.grid(row=6, column=2)

        removeAnimalsButton = Button(
            showAnimalWindowAdmin,
            text="Remove Animal",
            command=self.showAnimalWindowAdminRemoveAnimalWindowButtonClicked)
        removeAnimalsButton.grid(row=6, column=3)

        backButton = Button(
            showAnimalWindowAdmin,
            text="Back",
            command=self.showAnimalWindowAdminBackButtonClicked)
        backButton.grid(row=6, column=1)
示例#28
0
    def create_gui(self):
        pass
        # wait time
        self.instruction_frame = tk.LabelFrame(self.root, text="Instruction")

        # tk.Label(self.instruction_frame, text="Instruction : ").grid(row=0, column=0)
        self.instruction_byte_1_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_1_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=0, column=0)
        e.configure(state='readonly')

        self.instruction_byte_2_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_2_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=0, column=1)
        e.configure(state='readonly')

        self.instruction_byte_3_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_3_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=0, column=2)
        e.configure(state='readonly')

        self.instruction_byte_4_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_4_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=0, column=3)
        e.configure(state='readonly')

        self.instruction_byte_1_hex_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_1_hex_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=1, column=0)
        e.configure(state='readonly')

        self.instruction_byte_2_hex_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_2_hex_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=1, column=1)
        e.configure(state='readonly')

        self.instruction_byte_3_hex_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_3_hex_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=1, column=2)
        e.configure(state='readonly')

        self.instruction_byte_4_hex_sv = tk.StringVar()
        e = ttk.Entry(self.instruction_frame,
                      textvariable=self.instruction_byte_4_hex_sv,
                      justify=tk.CENTER,
                      width=24)
        e.grid(row=1, column=3)
        e.configure(state='readonly')

        tk.Label(self.instruction_frame, text="Type : ").grid(row=3, column=0)
        self.instruction_type_sv = tk.StringVar()
        ttk.Entry(self.instruction_frame,
                  textvariable=self.instruction_type_sv,
                  justify=tk.CENTER,
                  width=24).grid(row=4, column=0)
        tk.Label(self.instruction_frame, text="ALU : ").grid(row=3, column=1)
        self.instruction_alu_sv = tk.StringVar()
        ttk.Entry(self.instruction_frame,
                  textvariable=self.instruction_alu_sv,
                  justify=tk.CENTER,
                  width=24).grid(row=4, column=1)
        tk.Label(self.instruction_frame, text="Dest : ").grid(row=3, column=2)
        self.instruction_dest_sv = tk.StringVar()
        ttk.Entry(self.instruction_frame,
                  textvariable=self.instruction_dest_sv,
                  justify=tk.CENTER,
                  width=24).grid(row=4, column=2)
        tk.Label(self.instruction_frame, text="Jump : ").grid(row=3, column=3)
        self.instruction_jump_sv = tk.StringVar()
        ttk.Entry(self.instruction_frame,
                  textvariable=self.instruction_jump_sv,
                  justify=tk.CENTER,
                  width=24).grid(row=4, column=3)

        self.status_frame = tk.LabelFrame(self.root, text="Current State")
        self.register_frame = tk.LabelFrame(self.status_frame, text="Register")

        tk.Label(self.register_frame, text="").grid(row=0, column=0)

        tk.Label(self.register_frame, text="bin").grid(row=0, column=1)
        tk.Label(self.register_frame, text="hex").grid(row=0, column=2)
        tk.Label(self.register_frame, text="dec").grid(row=0, column=3)

        tk.Label(self.register_frame, text="A").grid(row=1, column=0)
        tk.Label(self.register_frame, text="D").grid(row=2, column=0)
        tk.Label(self.register_frame, text="out ALU").grid(row=3, column=0)
        tk.Label(self.register_frame, text="idx ROM").grid(row=4, column=0)

        self.A_bin_sv = tk.StringVar()
        self.A_hex_sv = tk.StringVar()
        self.A_dec_sv = tk.StringVar()
        self.D_dec_sv = tk.StringVar()
        self.D_bin_sv = tk.StringVar()
        self.D_hex_sv = tk.StringVar()
        self.out_dec_sv = tk.StringVar()
        self.out_bin_sv = tk.StringVar()
        self.out_hex_sv = tk.StringVar()
        self.idx_rom_bin_sv = tk.StringVar()
        self.idx_rom_hex_sv = tk.StringVar()
        self.idx_rom_dec_sv = tk.StringVar()

        e = ttk.Entry(self.register_frame,
                      textvariable=self.A_bin_sv,
                      justify=tk.CENTER,
                      width=25)
        e.configure(state='readonly')
        e.grid(row=1, column=1)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.A_hex_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=1, column=2)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.A_dec_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=1, column=3)

        e = ttk.Entry(self.register_frame,
                      textvariable=self.D_bin_sv,
                      justify=tk.CENTER,
                      width=25)
        e.configure(state='readonly')
        e.grid(row=2, column=1)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.D_hex_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=2, column=2)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.D_dec_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=2, column=3)

        e = ttk.Entry(self.register_frame,
                      textvariable=self.out_bin_sv,
                      justify=tk.CENTER,
                      width=25)
        e.configure(state='readonly')
        e.grid(row=3, column=1)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.out_hex_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=3, column=2)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.out_dec_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=3, column=3)

        e = ttk.Entry(self.register_frame,
                      textvariable=self.idx_rom_bin_sv,
                      justify=tk.CENTER,
                      width=25)
        e.configure(state='readonly')
        e.grid(row=4, column=1)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.idx_rom_hex_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=4, column=2)
        e = ttk.Entry(self.register_frame,
                      textvariable=self.idx_rom_dec_sv,
                      justify=tk.CENTER,
                      width=10)
        e.configure(state='readonly')
        e.grid(row=4, column=3)

        self.RAM_frame = tk.LabelFrame(self.status_frame, text="RAM")

        # create a treeview with one scrollbars

        style = ttk.Style()
        style.configure("mystyle.Treeview",
                        highlightthickness=0,
                        bd=0,
                        font=('Calibri', 11))  # Modify the font of the body
        style.configure("mystyle.Treeview.Heading",
                        font=('Calibri', 13,
                              'bold'))  # Modify the font of the headings
        style.layout("mystyle.Treeview", [('mystyle.Treeview.treearea', {
            'sticky': 'nswe'
        })])  # Remove the borders

        header = ['num', 'binary', 'hex', 'dec']
        self.tree_RAM = ttk.Treeview(columns=header,
                                     show="headings",
                                     style="mystyle.Treeview")
        vsb = ttk.Scrollbar(orient="vertical", command=self.tree_RAM.yview)

        self.tree_RAM.grid(column=0, row=0, sticky='nsew', in_=self.RAM_frame)
        vsb.grid(column=1, row=0, sticky='ns', in_=self.RAM_frame)
        self.RAM_frame.grid_columnconfigure(0, weight=1)
        self.RAM_frame.grid_rowconfigure(0, weight=1)

        for col in header:
            self.tree_RAM.heading(col, text=col.title())
            # adjust the column's width to the header string
            self.tree_RAM.column(col, width=tkFont.Font().measure(col.title()))

        # self.tree_RAM.bind('<<TreeviewSelect>>', self.treeview_instruction_select)

        # Current ROM instruction has a different background
        self.tree_RAM.tag_configure('current_address', background='orange')

        self.RAM_frame.pack(side="left", fill="both", expand=True)
        self.register_frame.pack(side="left", fill="both", expand=True)

        self.ROM_frame = tk.LabelFrame(self.root, text="ROM")
        self.ROM_listing = tk.LabelFrame(self.root, text="ROM Listing")
        self.ROM_modif = tk.LabelFrame(self.root, text="ROM edit")

        # create a treeview with one scrollbars

        style = ttk.Style()
        style.configure("mystyle.Treeview",
                        highlightthickness=0,
                        bd=0,
                        font=('Calibri', 11))  # Modify the font of the body
        style.configure("mystyle.Treeview.Heading",
                        font=('Calibri', 13,
                              'bold'))  # Modify the font of the headings
        style.layout("mystyle.Treeview", [('mystyle.Treeview.treearea', {
            'sticky': 'nswe'
        })])  # Remove the borders

        header = ['num', 'binary', 'hex', 'assembler']
        self.tree_ROM = ttk.Treeview(columns=header,
                                     show="headings",
                                     style="mystyle.Treeview")
        vsb = ttk.Scrollbar(orient="vertical", command=self.tree_ROM.yview)

        self.tree_ROM.grid(column=0,
                           row=0,
                           sticky='nsew',
                           in_=self.ROM_listing)
        vsb.grid(column=1, row=0, sticky='ns', in_=self.ROM_listing)
        self.ROM_listing.grid_columnconfigure(0, weight=1)
        self.ROM_listing.grid_rowconfigure(0, weight=1)

        for col in header:
            self.tree_ROM.heading(col, text=col.title())
            # adjust the column's width to the header string
            self.tree_ROM.column(col, width=tkFont.Font().measure(col.title()))

        self.tree_ROM.bind('<<TreeviewSelect>>',
                           self.treeview_instruction_select)

        # Current ROM instruction has a different background
        self.tree_ROM.tag_configure('current_instruction', background='orange')

        ttk.Button(self.ROM_modif,
                   text="Insert Instruction",
                   width=12,
                   command=self.insert_instruction).grid(row=0, column=0)
        self.cb_before_after_sv = tk.StringVar()
        self.cb_before_after = ttk.Combobox(
            self.ROM_modif,
            width=20,
            justify=tk.CENTER,
            textvariable=self.cb_before_after_sv,
            values='',
            state='readonly')
        # self.cb_before_after.bind('<<ComboboxSelected>>', self.select_IR)
        self.cb_before_after['values'] = ["before", "after"]
        self.cb_before_after.grid(row=0, column=1)
        self.cb_before_after.set("before")
        self.instruction_num_insert_sv = tk.StringVar()
        self.instruction_num_insert_sv.set("1")

        ttk.Entry(self.ROM_modif,
                  textvariable=self.instruction_num_insert_sv,
                  justify=tk.CENTER,
                  width=10).grid(row=0, column=2)

        self.ROM_listing.pack(side="top", fill="both", expand=True)
        self.ROM_modif.pack(side="top", fill="both", expand=True)

        # Navigation
        ############

        self.navigation_frame = tk.LabelFrame(self.root, text="Navigation")
        self.tick_frame = tk.LabelFrame(self.navigation_frame, text="Tick")
        self.clock_frame = tk.LabelFrame(self.navigation_frame, text="Clock")

        ttk.Button(self.tick_frame,
                   text="Next",
                   width=12,
                   command=self.next_tick).grid(row=0, column=0)
        ttk.Button(self.tick_frame,
                   text="Previous",
                   width=12,
                   command=self.previous_tick).grid(row=0, column=1)

        ttk.Button(self.clock_frame,
                   text="Start",
                   width=12,
                   command=self.start_tick).grid(row=0, column=2)
        ttk.Button(self.clock_frame,
                   text="Stop",
                   width=12,
                   command=self.stop_tick).grid(row=0, column=3)
        self.tick_freq_sv = tk.StringVar()
        self.tick_freq_sv.set("1")
        tk.Label(self.clock_frame, text="tick frequency (Hz)").grid(row=0,
                                                                    column=4)
        #TODO callback when changin freq
        ttk.Entry(self.clock_frame,
                  textvariable=self.tick_freq_sv,
                  justify=tk.CENTER,
                  width=10).grid(row=0, column=5)

        self.goto_frame = tk.LabelFrame(self.navigation_frame, text="Go to")
        tk.Label(self.goto_frame, text="instruction num :").grid(row=0,
                                                                 column=0)
        self.instruction_num_sv = tk.StringVar()
        ttk.Entry(self.goto_frame,
                  textvariable=self.instruction_num_sv,
                  justify=tk.CENTER,
                  width=10).grid(row=0, column=1)
        ttk.Button(self.goto_frame,
                   text="goto",
                   width=12,
                   command=self.goto_instruction).grid(row=0, column=2)
        ttk.Button(self.goto_frame,
                   text="restart",
                   width=12,
                   command=self.restart).grid(row=0, column=3)

        self.tick_frame.pack(side="left", fill="both", expand=True)
        self.clock_frame.pack(side="left", fill="both", expand=True)
        self.goto_frame.pack(side="left", fill="both", expand=True)

        #Vram
        self.image_frame = tk.LabelFrame(self.root, text="Image")
        self.image_WIDTH, self.image_HEIGHT = 16, 16
        self.image_dim_mult = 8

        self.image_canvas = tk.Canvas(
            self.image_frame,
            width=self.image_WIDTH * self.image_dim_mult,
            height=self.image_HEIGHT * self.image_dim_mult,
            bg="#000000")
        self.image_canvas.pack()
        self.img = PhotoImage(width=self.image_WIDTH * self.image_dim_mult,
                              height=self.image_HEIGHT * self.image_dim_mult)
        self.image_canvas.create_image(
            (self.image_WIDTH * self.image_dim_mult / 2,
             self.image_HEIGHT * self.image_dim_mult / 2),
            image=self.img,
            state="normal")

        # for x in range(4 * WIDTH):
        #     y = int(HEIGHT / 2 + HEIGHT / 4 * sin(x / 80.0))
        #     img.put("#ffffff", (x // 4, y))

        self.set_image_from_VRAM()

        # Pack frames
        self.navigation_frame.pack(side="top", fill="both", expand=True)
        self.ROM_frame.pack(side="top", fill="both", expand=True)
        self.instruction_frame.pack(side="top", fill="both", expand=True)
        self.status_frame.pack(side="top", fill="both", expand=True)
        self.image_frame.pack(side="top", fill="both", expand=True)

        self.menu_system = tk.Menu(self.root)

        # FILE#############
        self.menu_file = tk.Menu(self.menu_system, tearoff=0)
        self.menu_file.add_command(label='New / Clear',
                                   underline=1,
                                   accelerator="Ctrl+n",
                                   command=self.clear)
        self.menu_file.add_command(label='import',
                                   underline=4,
                                   accelerator="Ctrl+o",
                                   command=self.import_)
        self.menu_file.add_command(label='export',
                                   underline=1,
                                   accelerator="Ctrl+e",
                                   command=self.export)
        self.menu_file.add_command(label='quit', command=self.quit)
        self.menu_system.add_cascade(label="File", menu=self.menu_file)
        self.root.config(menu=self.menu_system)
    def create_widgets(self, *args):
        # menubar = Menu(self.master)
        # self.master.config(menu=menubar)
        # fileMenu = Menu(menubar)
        # fileMenu.add_command(label="Exit", command=self.save_sets())
        # menubar.add_cascade(label="File", menu=fileMenu)
        # menubar.config(background="blue")

        # Image
        self.imgtitle = ImageTk.PhotoImage(
            Image.open(
                'C:\\Users\\Chris\\PycharmProjects\\Runescape_RebuildList_V2\\snapsrebuild.png'
            ))
        self.lab = tk.Label(image=self.imgtitle)
        self.lab.grid(row=0, column=0, columnspan=6, padx=20, pady=20)
        self.infernalCape = ImageTk.PhotoImage(
            Image.open(
                'C:\\Users\\Chris\\PycharmProjects\\Runescape_RebuildList_V2\\infernal.gif'
            ))
        self.cape = tk.Label(image=self.infernalCape)
        self.cape.place(x=345, y=0)
        self.dclaws = ImageTk.PhotoImage(
            Image.open(
                'C:\\Users\\Chris\\PycharmProjects\\Runescape_RebuildList_V2\\dclaws.png'
            ))
        self.claws = tk.Label(image=self.dclaws)
        self.claws.place(x=20, y=20)
        self.tbow = ImageTk.PhotoImage(
            Image.open(
                'C:\\Users\\Chris\\PycharmProjects\\Runescape_RebuildList_V2\\tbow.png'
            ))
        self.bow = tk.Label(image=self.tbow)
        self.bow.place(x=110, y=50)
        # Supplies Label
        self.consume_label = tk.Label(self.root,
                                      text='Supplies:',
                                      font=('Arial', 12, 'bold'))
        self.consume_label.place(x=18, y=110)
        # AutoCompleteBox
        self.entry_0 = tk.StringVar()
        self.combobox_autocomplete = Combobox_Autocomplete(
            self.root,
            list_of_items,
            textvariable=self.entry_0,
            width=32,
            highlightthickness=1)
        self.combobox_autocomplete.grid(row=2,
                                        column=0,
                                        columnspan=5,
                                        sticky="W",
                                        padx=20,
                                        pady=10,
                                        ipady=3)
        # Quantity Box
        self.quantity = tk.StringVar()
        self.combobox_autocomplete1 = Combobox_Autocomplete(
            self.root,
            list_of_items,
            textvariable=self.quantity,
            width=5,
            highlightthickness=1,
            justify='center')
        self.combobox_autocomplete1.place(x=227, y=136)
        # Tree View
        self.tree = ttk.Treeview(self.root,
                                 height=20,
                                 columns=('id', 'items total', 'quantity'))
        self.tree.heading('#0', text='LIST OF ITEMS', anchor=tk.CENTER)
        self.tree.heading('#1', text='#', anchor=tk.CENTER)
        self.tree.heading('#2', text='PRICE', anchor=tk.CENTER)
        self.tree.heading('#3', text='TOTAL', anchor=tk.CENTER)
        self.tree.column('#0',
                         stretch=tk.YES,
                         minwidth=50,
                         width=200,
                         anchor='center')
        self.tree.column('#1',
                         stretch=tk.YES,
                         minwidth=50,
                         width=50,
                         anchor='center')
        self.tree.column('#2',
                         stretch=tk.YES,
                         minwidth=50,
                         width=120,
                         anchor='center')
        self.tree.column('#3',
                         stretch=tk.YES,
                         minwidth=50,
                         width=120,
                         anchor='center')
        self.tree.grid(row=3, column=0, padx=20)
        ysb = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview)
        ysb.grid(row=0, column=1, sticky='ns')
        self.tree.configure(yscroll=ysb.set)
        self.tree.bind('<ButtonRelease-1>', self.select_item)
        # Insert Button
        self.insert_butt = ttk.Button(self.root,
                                      text='Insert',
                                      width=5,
                                      command=lambda: self.commando1())
        self.insert_butt.place(x=275, y=133)
        # Total Labels down the bottom
        self.lab = tk.Label(self.root, text='0', font=('courier', 15, 'bold'))
        self.lab.place(x=420, y=607)
        self.lab1 = tk.Label(self.root,
                             text='TOTAL',
                             font=('courier', 15, 'bold'))
        self.lab1.place(x=350, y=607)
        self.gambling = tk.Label(self.root,
                                 text='Just Say Neigh To Gambling',
                                 font=('courier', 15, 'bold'))
        self.gambling.place(x=20, y=650)
        # Delete Button
        self.del_button1 = ttk.Button(self.root,
                                      text='Delete',
                                      command=lambda: self.delbutton1())
        self.del_button1.place(x=469, y=133)
        self.filemenu = Menu(self.root, tearoff=0)
        self.filemenu.add_command(label="Open", command='hello')
        self.filemenu.add_command(label="Save", command='hello')
        self.filemenu.add_separator()
        self.filemenu.add_command(label="Exit", command='root.quit')

        # Save Current Set
        self.save_butt = ttk.Button(self.root,
                                    text='Save',
                                    command=lambda: self.save_sets())
        self.save_butt.place(x=175, y=607)

        # Update SAVED Sets Button
        self.save_butt = ttk.Button(self.root,
                                    text='Load',
                                    width=7,
                                    command=lambda: self.load_test())
        self.save_butt.place(x=210, y=607)

        # Delete Sets Button
        self.save_butt = ttk.Button(self.root,
                                    text='Delete',
                                    width=7,
                                    command=lambda: self.yeet())
        self.save_butt.place(x=263, y=607)

        # Saved Sets Entry Box
        self.save_entry = tk.StringVar()
        self.saved_sets = ttk.Combobox(self.root,
                                       width=20,
                                       text="F*****t",
                                       textvariable=self.save_entry,
                                       values='F*****t')
        self.saved_sets.place(x=20, y=610)
示例#30
0
    def filterNeighborhood():
        root = Tk()
        root.configure(bg="Grey")
        root.title("Housing Database")
        root.resizable(width=1, height=1)
        tv = ttk.Treeview(root)
        tv.pack(expand=True, fill='y')

        tv['columns'] = ('Id', 'Street', 'Alley', 'Utilities', 'Neighborhood',
                         'BldgType', 'HouseStyle', 'OverallQual',
                         'OverallCond', 'YearBuilt')
        tv.heading('#0', text='Id', anchor='center')
        tv.column('#0', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#1', text='Street', anchor='center')
        tv.column('#1', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#2', text='Alley', anchor='center')
        tv.column('#2', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#3', text='Utilities', anchor='center')
        tv.column('#3', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#4', text='Neighborhood', anchor='center')
        tv.column('#4', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#5', text='BldgType', anchor='center')
        tv.column('#5', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#6', text='HouseStyle', anchor='center')
        tv.column('#6', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#7', text='OverallQual', anchor='center')
        tv.column('#7', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#8', text='OverallCond', anchor='center')
        tv.column('#8', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.heading('#9', text='YearBuilt', anchor='center')
        tv.column('#9', minwidth=0, width=130, stretch=NO, anchor='center')
        tv.tag_configure('gray', background='#cccccc')

        i1 = entry3.get()
        mycursor.execute(
            "select Id, Street, Alley, Utilities, Neighborhood, BldgType, HouseStyle, OverallQual, OverallCond, YearBuilt from test where Neighborhood = '%s'"
            % i1)
        result = mycursor.fetchall()
        Id = ""
        Street = ""
        Alley = ""
        Utilities = ""
        Neighborhood = ""
        BldgType = ""
        HouseStyle = ""
        OverallQual = ""
        OverallCond = ""
        YearBuilt = ""
        for i in result:
            Id = i[0]
            Street = i[1]
            Alley = i[2]
            Utilities = i[3]
            Neighborhood = i[4]
            BldgType = i[5]
            HouseStyle = i[6]
            OverallQual = i[7]
            OverallCond = i[8]
            YearBuilt = i[9]
            tv.insert("",
                      'end',
                      text=Id,
                      values=(Street, Alley, Utilities, Neighborhood, BldgType,
                              HouseStyle, OverallQual, OverallCond, YearBuilt))