Ejemplo n.º 1
0
    def student():
        def deneme():
            datelist = []
            listbox1 = Listbox(report, width=60, height=10, font=("bold", 15))
            listbox1.insert(END, )
            scrollbar1 = Scrollbar(
                report,
                orient="vertical",
            )
            scrollbar1.config(command=listbox1.yview)
            scrollbar1.place(x=950, y=450, height=242)
            listbox1.config(yscrollcommand=scrollbar1.set)
            listbox1.place(
                x=300,
                y=450,
            )

            curser.execute("use cs350deneme")
            sql_select = """select * from attendance2 where sid=%s and start like %s"""
            value = e3.get() + "%"
            curser.execute(sql_select, (username1, value))
            r = curser.fetchall()
            for i in r:
                cid = str(i[0])
                start = str(i[1])
                sid = str(i[2])
                attended = str(i[3])
                sign = str(i[4])
                tolistbox = cid + " | " + start + " | " + sid + " | " + attended + " | " + sign
                datelist.append(tolistbox)
                # print attendcelist
            for i in datelist:
                listbox1.insert(END, i)

        curser.execute("use cs350deneme")
        sql_search = """select cid from enroll where sid =%s"""
        curser.execute(sql_search, (username1, ))
        results = curser.fetchall()
        course_list = []
        for i in results:
            course_list.append(str(i[0]))

        lb2 = Label(report, text="Enrolled Classes", font=("bold", 15))
        lb2.place(x=90, y=50)
        for x in range(len(course_list)):
            global compButton
            compButton = Button(report,
                                text=course_list[x],
                                width=10,
                                height=1,
                                bg="turquoise4",
                                fg="white",
                                font="5",
                                relief=RAISED,
                                overrelief=RIDGE,
                                command=lambda z=course_list[x]: listbox(z))
            compButton.place(x=x * 100 + 300, y=50)

        lb3 = Label(report, text="Absent At :", font=("bold", 15))
        lb3.place(x=90, y=400)
        e3 = Entry(report, width=10, font=("bold", 15), highlightthickness=2)
        e3.place(x=200, y=400)
        searchbutton = Button(report,
                              text="SEARCH",
                              width=10,
                              height=1,
                              bg="turquoise4",
                              fg="white",
                              font="5",
                              relief=RAISED,
                              overrelief=RIDGE,
                              command=deneme)
        searchbutton.place(x=350, y=400)
    def __init__(self, port, pin1, pin2, pin3, pin4, pin5):
        # Setting up Arduino
        self.arduino = Arduino(port)

        self.servo1 = pin1
        self.servo2 = pin2
        self.servo3 = pin3
        self.servo4 = pin4
        self.servo5 = pin5

        self.arduino.digital[self.servo1].mode = SERVO
        self.arduino.digital[self.servo2].mode = SERVO
        self.arduino.digital[self.servo3].mode = SERVO
        self.arduino.digital[self.servo4].mode = SERVO
        self.arduino.digital[self.servo5].mode = SERVO

        # Setting up Database Connect
        path = 'C:/Users/Mohamad/Desktop/db/servo_2d.db'
        self.Connect = lite.connect(path)

        self.servo1OldVal = 0
        self.servo2OldVal = 0
        self.servo3OldVal = 0
        self.servo4OldVal = 0
        self.servo5OldVal = 0

        self.root = Tkinter.Tk()
        self.root.geometry('600x600')

        # GUI variables
        self.servo1Val = IntVar()
        self.servo2Val = IntVar()
        self.servo3Val = IntVar()
        self.servo4Val = IntVar()
        self.servo5Val = IntVar()

        self.pointName = StringVar()

        # GUI Components
        servo1_slider = Tkinter.Scale(self.root,
                                      label='Servo 1',
                                      length=400,
                                      from_=0, to_=360,
                                      orient=Tkinter.VERTICAL,
                                      variable=self.servo1Val)
        servo1_slider.grid(column=1, row=2)

        servo2_slider = Tkinter.Scale(self.root,
                                      label='Servo 2',
                                      length=400,
                                      from_=0, to_=180,
                                      orient=Tkinter.VERTICAL,
                                      variable=self.servo2Val)
        servo2_slider.grid(column=2, row=2)

        servo3_slider = Tkinter.Scale(self.root,
                                      label='Servo 3',
                                      length=400,
                                      from_=0, to_=180,
                                      orient=Tkinter.VERTICAL,
                                      variable=self.servo3Val)
        servo3_slider.grid(column=3, row=2)

        servo4_slider = Tkinter.Scale(self.root,
                                      label='Servo 4',
                                      length=400,
                                      from_=0, to_=180,
                                      orient=Tkinter.VERTICAL,
                                      variable=self.servo4Val)
        servo4_slider.grid(column=4, row=2)

        servo5_slider = Tkinter.Scale(self.root,
                                      label='Servo 5',
                                      length=400,
                                      from_=0, to_=60,
                                      orient=Tkinter.VERTICAL,
                                      variable=self.servo5Val)
        servo5_slider.grid(column=5, row=2)

        self.btnSave = Button(self.root, text='Save', command=self.onSaveClicked)
        self.btnSave.grid(column=1, row=0)

        self.btnGet = Button(self.root, text='Get', command=self.onGetClicked)
        self.btnGet.grid(column=6, row=0)

        self.pName = Entry(self.root, textvariable=self.pointName)
        self.pName.grid(column=0, row=0)

        self.root.after(100, self.onSliderChange)
        self.root.mainloop()
Ejemplo n.º 3
0
    def init_gui(self):
        # create root window
        self.rootWindow = Tk()
        self.statusText = StringVar(value=self.statusStr)
        self.set_status_str("Simulation not yet started")

        self.rootWindow.wm_title(self.titleText)
        self.rootWindow.protocol('WM_DELETE_WINDOW', self.quit_gui)
        self.rootWindow.geometry('550x700')
        self.rootWindow.columnconfigure(0, weight=1)
        self.rootWindow.rowconfigure(0, weight=1)

        self.frameSim = Frame(self.rootWindow)

        self.frameSim.pack(expand=YES, fill=BOTH, padx=5, pady=5, side=TOP)
        self.status = Label(self.rootWindow,
                            width=40,
                            height=3,
                            relief=SUNKEN,
                            bd=1,
                            textvariable=self.statusText)
        self.status.pack(side=TOP, fill=X, padx=1, pady=1, expand=NO)

        self.runPauseString = StringVar()
        self.runPauseString.set("Run")
        self.buttonRun = Button(self.frameSim,
                                width=30,
                                height=2,
                                textvariable=self.runPauseString,
                                command=self.run_event)
        self.buttonRun.pack(side=TOP, padx=5, pady=5)

        self.show_help(
            self.buttonRun,
            "Runs the simulation (or pauses the running simulation)")
        self.buttonStep = Button(self.frameSim,
                                 width=30,
                                 height=2,
                                 text="Step Once",
                                 command=self.step_once)
        self.buttonStep.pack(side=TOP, padx=5, pady=5)
        self.show_help(self.buttonStep, "Steps the simulation only once")
        self.buttonReset = Button(self.frameSim,
                                  width=30,
                                  height=2,
                                  text="Reset",
                                  command=self.reset_model)
        self.buttonReset.pack(side=TOP, padx=5, pady=5)
        self.show_help(self.buttonReset, "Resets the simulation")

        for param in self.model.params:
            var_text = self.param_gui_names.get(param, param)
            can = Canvas(self.frameSim)
            lab = Label(can,
                        width=25,
                        height=1 + var_text.count('\n'),
                        text=var_text,
                        anchor=W,
                        takefocus=0)
            lab.pack(side='left')
            ent = Entry(can, width=11)
            val = getattr(self.model, param)
            if isinstance(val, bool):
                val = int(val)  # Show 0/1 which can convert back to bool
            ent.insert(0, str(val))
            ent.pack(side='left')
            can.pack(side='top')
            self.param_entries[param] = ent
        if self.param_entries:
            self.buttonSaveParameters = Button(
                self.frameSim,
                width=50,
                height=1,
                command=self.save_parameters_cmd,
                text="Save parameters to the running model",
                state=DISABLED)
            self.show_help(
                self.buttonSaveParameters,
                "Saves the parameter values.\n Not all values may take effect "
                "on a running model\n A model reset might be required.")
            self.buttonSaveParameters.pack(side='top', padx=5, pady=5)
            self.buttonSaveParametersAndReset = Button(
                self.frameSim,
                width=50,
                height=1,
                command=self.save_parameters_and_reset_cmd,
                text="Save parameters to the model and reset the model")
            self.show_help(
                self.buttonSaveParametersAndReset,
                "Saves the given parameter values and resets the model")
            self.buttonSaveParametersAndReset.pack(side='top', padx=5, pady=5)

        can = Canvas(self.frameSim)
        lab = Label(can,
                    width=25,
                    height=1,
                    text="Step size ",
                    justify=LEFT,
                    anchor=W,
                    takefocus=0)
        lab.pack(side='left')
        self.stepScale = Scale(can,
                               from_=1,
                               to=500,
                               resolution=1,
                               command=self.change_step_size,
                               orient=HORIZONTAL,
                               width=25,
                               length=150)
        self.stepScale.set(self.stepSize)
        self.show_help(
            self.stepScale,
            "Skips model redraw during every [n] simulation steps\n" +
            " Results in a faster model run.")
        self.stepScale.pack(side='left')
        can.pack(side='top')

        can = Canvas(self.frameSim)
        lab = Label(can,
                    width=25,
                    height=1,
                    text="Step visualization delay in ms ",
                    justify=LEFT,
                    anchor=W,
                    takefocus=0)
        lab.pack(side='left')
        self.stepDelay = Scale(can,
                               from_=0,
                               to=max(2000, self.timeInterval),
                               resolution=10,
                               command=self.change_step_delay,
                               orient=HORIZONTAL,
                               width=25,
                               length=150)
        self.stepDelay.set(self.timeInterval)
        self.show_help(
            self.stepDelay, "The visualization of each step is " +
            "delays by the given number of " + "milliseconds.")
        self.stepDelay.pack(side='left')
        can.pack(side='top')
     def __init__(self, master): ##Inititilize Main
          self.master = master ##Define master
          master.title ("GUI Name") ##Create Title for GUI Window
          master.geometry("816x504") ##Define Window Size
          master.resizable (width = False, height = False)##Disable Max Button on Window

          master.columnconfigure(0,minsiz=187,weight=1) ##Column Definition (size)
          master.columnconfigure(1,minsiz=306,weight=1) ##Column Definition (size)
          master.columnconfigure(2,minsiz=160.3536,weight=1) ##Column Definition (size)
          master.columnconfigure(3,minsiz=160.3536,weight=1) ##Column Definition (size)

          master.rowconfigure(0,minsiz=98.2464,weight=1) ##Row Definition (size)
          master.rowconfigure(1,minsiz=323.2512,weight=1) ##Row Definition (size)
          master.rowconfigure(2,minsiz=56.6784,weight=1) ##Row Definition (size)
          master.rowconfigure(3,minsiz=39.3216,weight=1) ##Row Definition (size)

          self.projectNameLabel=projectNameLabel=Label(master,text='Project Name:',font=('BoldCourier',16)) ##Label Widget for projectNameEntry Box
          projectNameLabel.grid(row=0,column=0) ##Grid Label

          self.projectNameEntry=projectNameEntry=Entry(master,text='Enter Name Of Project',font=('Courier',16)) ##Entry Widget for Entering Name Of Project
          projectNameEntry.grid(row=0,column=1) ##Gid Entry Widget
          projectNameEntry.focus() ##Set Curser To Entry Widget

          self.includeStartingFilesVariable=includeStartingFilesVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.includeStartingFiles=includeStartingFiles=Checkbutton(master,text='Include\nStarting Files',borderwidth=2,relief='groove',variable=includeStartingFilesVariable,font=('Courier',16)) ##Checkbutton Widget for Including Starting Files
          includeStartingFiles.grid(row=0,column=2, columnspan=2) ##Grid Checkbutton Widget

          self.folderFrame=folderFrame=Frame(master,width=462, height=342, borderwidth=2,relief='groove') ##Frame Widget to Create Better GUI Layout
          folderFrame.grid(row=1,column=0,rowspan=2,columnspan=2) ##Grid Frame Widget

          folderFrame.columnconfigure(0,minsize=156,weight=1) ##Column Definition (size)
          folderFrame.columnconfigure(1,minsize=12.9984,weight=1) ##Column Definition (size)
          folderFrame.columnconfigure(2,minsize=149.0016,weight=1) ##Column Definition (size)
          folderFrame.columnconfigure(3,minsize=144,weight=1) ##Column Definition (size)

          folderFrame.rowconfigure(0,minsize=36,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(1,minsize=34.6656,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(2,minsize=42,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(3,minsize=12.9984,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(4,minsize=42,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(5,minsize=12.9984,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(6,minsize=42,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(7,minsize=12.9984,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(8,minsize=42,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(9,minsize=12.9984,weight=1) ##Row Definition (size)
          folderFrame.rowconfigure(10,minsize=49.872,weight=1) ##Row Definition (size)

          self.folderFrameLabel=folderFrameLabel=Label(folderFrame,text='Folders To Include',font=('BoldCourier',16)) ##Label Widget for Frame
          folderFrameLabel.grid(row=0,column=0,columnspan=4) ##Grid Label Widget

          self.mainFolderLabel=mainFolderLabel=Label(folderFrame,text='Main Folders',font=('BoldCourier',12)) ##Label Widget for Main Folders
          mainFolderLabel.grid(row=1,column=0) ##Grid Label Widget

          self.divider0=divider0=Frame(folderFrame,width=2,height=280,borderwidth=1,relief='sunken') ##Frame to act as Divider for Better GUI Layout
          divider0.grid(row=1,column=1,rowspan=10) ##Grid Divider

          self.subFolderLabel=subFolderLabel=Label(folderFrame,text='Sub-Folders',font=('BoldCourier',12)) ##Label Widget for Sub-Folders
          subFolderLabel.grid(row=1,column=2,columnspan=2) ##Grid Label Widget

          self.firmwareMainVariable=firmwareMainVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.firmwareMain=firmwareMain=Checkbutton(folderFrame,width=10,text='Firmware',borderwidth=2,relief='groove',anchor='w',variable=firmwareMainVariable,font=('Courier',12)) ##Checkbutton Widget for Firmware Main Folder
          firmwareMain.grid(row=2,column=0) ##Grid Ceckbutton Widget

          self.firmwareResourcesVariable=firmwareResourcesVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.firmwareResources=firmwareResources=Checkbutton(folderFrame,width=12,text='Resources',borderwidth=2,relief='groove',anchor='w',variable=firmwareResourcesVariable,font=('Courier',12)) ##Checkbutton Widget for Firmware-Resources Sub-Folder
          firmwareResources.grid(row=2,column=2) ##Grid Ceckbutton Widget

          self.firmwareArchiveVariable=firmwareArchiveVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.firmwareArchive=firmwareArchive=Checkbutton(folderFrame,width=8,text='Archive',borderwidth=2,relief='groove',anchor='w',variable=firmwareArchiveVariable,font=('Courier',12)) ##Checkbutton Widget for Firmware-Archive Sub-Folder
          firmwareArchive.grid(row=2,column=3) ##Grid Ceckbutton Widget

          self.divider1=divider1=Frame(folderFrame,width=400,height=2,borderwidth=1,relief='sunken') ##Frame to act as Divider for Better GUI Layout
          divider1.grid(row=3,column=0,columnspan=4) ##Grid Divider

          self.hardwareMainVariable=hardwareMainVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.hardwareMain=hardwareMain=Checkbutton(folderFrame,width=10,text='Hardware',borderwidth=2,relief='groove',anchor='w',variable=hardwareMainVariable,font=('Courier',12)) ##Checkbutton Widget for Hardware Main Folder
          hardwareMain.grid(row=4,column=0) ##Grid Ceckbutton Widget

          self.hardwarePartsVariable=hardwarePartsVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.hardwareParts=hardwareParts=Checkbutton(folderFrame,width=12,text='Parts',borderwidth=2,relief='groove',anchor='w',variable=hardwarePartsVariable,font=('Courier',12)) ##Checkbutton Widget for Hardware-Parts Sub-Folder
          hardwareParts.grid(row=4,column=2) ##Grid Ceckbutton Widget

          self.hardwareArchiveVariable=hardwareArchiveVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.hardwareArchive=hardwareArchive=Checkbutton(folderFrame,width=8,text='Archive',borderwidth=2,relief='groove',anchor='w',variable=hardwareArchiveVariable,font=('Courier',12)) ##Checkbutton Widget for Hardware-Archive Sub-Folder
          hardwareArchive.grid(row=4,column=3) ##Grid Ceckbutton Widget

          self.divider2=divider2=Frame(folderFrame,width=400,height=2,borderwidth=1,relief='sunken') ##Frame to act as Divider for Better GUI Layout
          divider2.grid(row=5,column=0,columnspan=4) ##Grid Divider

          self.resourcesMainVariable=resourcesMainVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.resourcesMain=resourcesMain=Checkbutton(folderFrame,width=10,text='Resources',borderwidth=2,relief='groove',anchor='w',variable=resourcesMainVariable,font=('Courier',12)) ##Checkbutton Widget for Resources Main Folder
          resourcesMain.grid(row=6,column=0) ##Grid Ceckbutton Widget

          self.resourcesDatasheetsVariable=resourcesDatasheetsVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.resourcesDatasheets=resourcesDatasheets=Checkbutton(folderFrame,width=12,text='Datasheets',borderwidth=2,relief='groove',anchor='w',variable=resourcesDatasheetsVariable,font=('Courier',12)) ##Checkbutton Widget for Resources-Datasheets Sub-Folder
          resourcesDatasheets.grid(row=6,column=2) ##Grid Ceckbutton Widget

          self.resourcesArchiveVariable=resourcesArchiveVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.resourcesArchive=resourcesArchive=Checkbutton(folderFrame,width=8,text='Archive',borderwidth=2,relief='groove',anchor='w',variable=resourcesArchiveVariable,font=('Courier',12)) ##Checkbutton Widget for Resources-Archive Sub-Folder
          resourcesArchive.grid(row=6,column=3) ##Grid Ceckbutton Widget

          self.divider3=divider3=Frame(folderFrame,width=400,height=2,borderwidth=1,relief='sunken') ##Frame to act as Divider for Better GUI Layout
          divider3.grid(row=7,column=0,columnspan=4) ##Grid Divider

          self.softwareMainVariable=softwareMainVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.softwareMain=softwareMain=Checkbutton(folderFrame,text='Software',width=10,borderwidth=2,relief='groove',anchor='w',variable=softwareMainVariable,font=('Courier',12)) ##Checkbutton Widget for Software Main Folder
          softwareMain.grid(row=8,column=0) ##Grid Ceckbutton Widget

          self.softwareResourcesVariable=softwareResourcesVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.softwareResources=softwareResources=Checkbutton(folderFrame,width=12,text='Resources',borderwidth=2,relief='groove',anchor='w',variable=softwareResourcesVariable,font=('Courier',12)) ##Checkbutton Widget for Software-Resources Sub-Folder
          softwareResources.grid(row=8,column=2) ##Grid Ceckbutton Widget

          self.softwareArchiveVariable=softwareArchiveVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.softwareArchive=softwareArchive=Checkbutton(folderFrame,width=8,text='Archive',borderwidth=2,relief='groove',anchor='w',variable=softwareArchiveVariable,font=('Courier',12)) ##Checkbutton Widget for Software-Archive Sub-Folder
          softwareArchive.grid(row=8,column=3) ##Grid Ceckbutton Widget

          self.divider4=divider4=Frame(folderFrame,width=400,height=2,borderwidth=1,relief='sunken') ##Frame to act as Divider for Better GUI Layout
          divider4.grid(row=9,column=0,columnspan=4) ##Grid Divider

          self.archiveMainVariable=archiveMainVariable=BooleanVar() ##Boolean to Hold Value of Checkbutton
          self.archiveMain=archiveMain=Checkbutton(folderFrame,width=10,text='Archive',borderwidth=2,relief='groove',anchor='w',variable=archiveMainVariable,font=('Courier',12)) ##Checkbutton Widget for Archive Main Folder
          archiveMain.grid(row=10,column=0) ##Grid Ceckbutton Widget

          self.instructionFrame=instructionFrame=Frame(master,width=300,height=288,borderwidth=2,relief='groove') ##Frame for Instructions
          instructionFrame.grid(row=1,column=2,columnspan=2) ##Grid Frame

          self.instuctionLabel=instructionLabel=Label(instructionFrame,text='Project Name will\nbe used as Folder Name.\r\nFolder can be found on\nDesktop after Creation.',font=('BoldCourier',16)) ##Label Holding Instructions
          instructionLabel.grid(row=0,column=0,pady=80,padx=30) ##Grid Label

          self.cancelButton=cancelButton=Button(master,text='Cancel', width=42,height=108,font=('BoldCourier',16),foreground='red',command=self.CancelCommand) ##Button Widget to Cancel/Close Program
          cancelButton.grid(row=2,column=2,padx=10) ##Grid Button Widget

          self.createButton=createButton=Button(master,text='Create',width=42,height=108,font=('BoldCourier',16),foreground='green',command=self.CreateCommand) ##Button Widget to Create Folder Structure
          createButton.grid(row=2,column=3,padx=10) ##Grid Button Widget

          self.versionNumber=versionNumber=Label(text='Ver. 0.1') ##Label to Display Version Number
          versionNumber.grid(row=3,column=3) ##Grid Label Widget
Ejemplo n.º 5
0
        f = open(fn, 'U')
    except IOError, e:
        from cStringIO import StringIO
        f = StringIO(DEMO)
        en.delete(0, 'end')
        if fn.lower() == 'demo':
            en.insert(0,fn)
        else:
            import os
            en.insert(0,r"DEMO (can't open %s: %s)" % (os.path.join(os.getcwd(), fn), str(e)))
        en.update_idletasks()
    txt2ppt(line.rstrip() for line in f)
    f.close()

if __name__ == '__main__':
    tk = Tk()
    lb = Label(tk, text='Enter file [or "DEMO"]:')
    lb.pack()
    en = Entry(tk)
    en.bind('<Return>', _start)
    en.pack()
    en.focus_set()
    quit = Button(tk, text='QUIT', command=tk.quit, fg='white', bg='red')
    quit.pack(fill='x', expand=True)
    tk.mainloop()





        tkMessageBox.showinfo('Warning', u'网址读取错误,请尝试使用浏览器读取网址判断是否可以打开')
        return
    if not title:
        tkMessageBox.showinfo('Warning', u'检测到非微信文章页面')
        return
    thread.start_new_thread(download, (url, title, picUrl))
    tkMessageBox.showinfo('Info', u'已经成功加入队列')

def download(url, title, picUrl):
    for sk in (r'\/:*?"<>|'): title = title.replace(sk, '')
    title = title.replace('&nbsp;', ' ')
    if not os.path.exists(title.encode('cp936')): os.mkdir(title.encode('cp936'))
    download_pic_from_url(picUrl, os.path.join(title, u'标题图'))
    for i, picUrl in enumerate(get_pic_url_from_url(url), 1):
        download_pic_from_url(picUrl, os.path.join(title, str(i)))
    TASK_STORAGE.append(title)

mainWindow = Tk()
button = Button(mainWindow, cnf = {'command': button_clicked, 'text': 'Download', 'justify': 'right', })
inputEntry = Entry(mainWindow, width=70)
inputEntry.pack()
button.pack()
mainWindow.title(u'微信图片下载器')
while 1:
    mainWindow.update_idletasks()
    mainWindow.update()
    try:
        tkMessageBox.showinfo('Info', u'读取成功,请打开"%s"文件夹查看'%TASK_STORAGE.pop())
    except:
        pass
	def __init__(self, master):
		master.title('Univention Lizenz Generator')
		self.master = master
		self.logoframe = Frame(self.master, bg='red')
		self.logoframe.pack(side=TOP, fill=X, expand=YES)
		self.lftopframes = LabelFrame(self.master)
		self.lftopframes.pack(side=TOP, fill=X, expand=YES)
		self.lframe = Frame(self.lftopframes)
		self.rframe = Frame(self.lftopframes)
		self.lframe.pack(side=LEFT, fill=X, expand=YES)
		self.rframe.pack(side=RIGHT, fill=X, expand=YES)

		self.bframe = Frame(self.master)
		self.bframe.pack(fill=X)

		self.kname = StringVar()
		self.kname.set('test')

		self.chkevar = IntVar()
		self.chkevar.set('1')
		self.chkivar = IntVar()
		self.chkovar = IntVar()
		self.chkdvar = IntVar()

		self.exday = StringVar()
		self.exmonth = StringVar()
		self.exyear = StringVar()
		self.getdate()  # set date to localdate (month+3)

		try:
			self.logo = PhotoImage(file='/var/www/head_logo.gif')
		except TclError:  # fall back to 64x64 white
			self.logo = PhotoImage(data='R0lGODdhQABAAIAAAP///wAAACwAAAAAQABAAAACRYSPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrhdQAAA7')
		# self.logo.pack() #muss man nicht packen??!!
		self.logolabel = Label(self.logoframe, image=self.logo, bg='#CC3300')
		self.logolabel.pack(side=LEFT, fill=X, expand=YES)

		self.lfname = LabelFrame(self.lframe, font=("Helvetica", 11), text='Kundenname:')
		self.lfname.pack(fill=X)
		self.ekname = Entry(self.lfname, textvariable=self.kname, width=30)
		self.ekname.pack(side=LEFT)

		self.lfdate = LabelFrame(self.lframe, font=("Helvetica", 11), text='Ablaufdatum (TT/MM/JJ):')
		self.lfdate.pack(fill=X)
		self.eexd = Entry(self.lfdate, textvariable=self.exday, width=2)
		self.eexd.pack(side=LEFT)
		self.eexm = Entry(self.lfdate, textvariable=self.exmonth, width=2)
		self.eexm.pack(side=LEFT)
		self.eexy = Entry(self.lfdate, textvariable=self.exyear, width=2)
		self.eexy.pack(side=LEFT)
		self.chkdate = Checkbutton(self.lfdate, text='Unbeschränkt', variable=self.chkdvar)
		self.chkdate.pack(side=RIGHT)

		self.lfchke = LabelFrame(self.lframe, font=("Helvetica", 11), text='Evaluationslizenz:')
		self.lfchke.pack(fill=X)
		self.chke = Checkbutton(self.lfchke, variable=self.chkevar)
		self.chke.pack(side=LEFT)

		self.lfchki = LabelFrame(self.lframe, font=("Helvetica", 11), text='Interne Lizenz:')
		self.lfchki.pack(fill=X)
		self.chki = Checkbutton(self.lfchki, variable=self.chkivar)
		self.chki.pack(side=LEFT)

		self.lfchko = LabelFrame(self.lframe, font=("Helvetica", 11), text='Altes Lizenzformat (vor 1.2-3):')
		self.lfchko.pack(fill=X)
		self.chko = Checkbutton(self.lfchko, variable=self.chkovar, command=self.makegrey)
		self.chko.pack(side=LEFT)

		self.kdn = StringVar()
		self.kdn.set('dc=univention,dc=de')
		self.lfdn = LabelFrame(self.rframe, font=("Helvetica", 11), text='Kunde DN:')
		self.lfdn.pack(fill=X)
		self.ekdn = Entry(self.lfdn, textvariable=self.kdn, width=30)
		self.ekdn.pack(side=LEFT)

		self.kmaxacc = IntVar()
		self.kmaxacc.set('999')
		self.kmaxgacc = IntVar()
		self.kmaxgacc.set('999')
		self.kmaxcli = IntVar()
		self.kmaxcli.set('999')
		self.kmaxdesk = IntVar()
		self.kmaxdesk.set('999')

		self.chkmaxaccvar = IntVar()
		self.chkmaxaccvar.set('0')
		self.chkmaxgaccvar = IntVar()
		self.chkmaxgaccvar.set('0')
		self.chkmaxclivar = IntVar()
		self.chkmaxclivar.set('0')
		self.chkmaxdeskvar = IntVar()
		self.chkmaxdeskvar.set('0')

		self.lfmaxacc = LabelFrame(self.rframe, font=("Helvetica", 11), text='Max. Accounts:')
		self.lfmaxacc.pack(fill=X)
		self.lfmaxgacc = LabelFrame(self.rframe, font=("Helvetica", 11), text='Max. Groupware Accounts:')
		self.lfmaxgacc.pack(fill=X)
		self.lfmaxcli = LabelFrame(self.rframe, font=("Helvetica", 11), text='Max. Clients:')
		self.lfmaxcli.pack(fill=X)
		self.lfmaxdesk = LabelFrame(self.rframe, font=("Helvetica", 11), text='Max. Univention Desktops:')
		self.lfmaxdesk.pack(fill=X)

		self.emaxacc = Entry(self.lfmaxacc, textvariable=self.kmaxacc)
		self.emaxacc.pack(side=LEFT)
		self.chkmaxacc = Checkbutton(self.lfmaxacc, text='Unbeschränkt', variable=self.chkmaxaccvar)
		self.chkmaxacc.pack(side=LEFT)

		self.emaxgacc = Entry(self.lfmaxgacc, textvariable=self.kmaxgacc)
		self.emaxgacc.pack(side=LEFT)
		self.chkmaxgacc = Checkbutton(self.lfmaxgacc, text='Unbeschränkt', variable=self.chkmaxgaccvar)
		self.chkmaxgacc.pack(side=LEFT)

		self.emaxcli = Entry(self.lfmaxcli, textvariable=self.kmaxcli)
		self.emaxcli.pack(side=LEFT)
		self.chkmaxcli = Checkbutton(self.lfmaxcli, text='Unbeschränkt', variable=self.chkmaxclivar)
		self.chkmaxcli.pack(side=LEFT)

		self.emaxdesk = Entry(self.lfmaxdesk, textvariable=self.kmaxdesk)
		self.emaxdesk.pack(side=LEFT)
		self.chkmaxdesk = Checkbutton(self.lfmaxdesk, text='Unbeschränkt', variable=self.chkmaxdeskvar)
		self.chkmaxdesk.pack(side=LEFT)

		self.bexit = Button(self.bframe, text='Beenden', command=self.quit)
		self.bexit.pack(side=RIGHT)

		self.bsave = Button(self.bframe, text='Lizenz erzeugen', command=self.generate)
		self.bsave.pack(side=RIGHT)
Ejemplo n.º 8
0
 def _create_selector(self, parent, default, hidden):
     self._entry = Entry(parent, show='*' if hidden else '')
     self._entry.insert(0, default)
     self._entry.select_range(0, END)
     return self._entry
Ejemplo n.º 9
0
    def __init__(self, master):
        self.master = master
        master.title("Enter Date Range:")

        self.label_month = Label(master, text="Month")
        self.label_date = Label(master, text="Date")
        self.label_year = Label(master, text="Year")
        self.label_startDate = Label(master, text="Start Date:")
        self.label_endDate = Label(master, text="End Date:")
        self.label_stock = Label(master, text="Stock:")
        self.label_slowMA = Label(master, text="Slow MA:")
        self.label_fastMA = Label(master, text="Fast MA:")
        self.entry_stock = Entry(master)
        vcmd = master.register(self.validate)
        self.entry_d1 = Entry(master,
                              validate="key",
                              validatecommand=(vcmd, '%P', 'd1'),
                              text=1)
        self.entry_d2 = Entry(master,
                              validate="key",
                              validatecommand=(vcmd, '%P', 'd2'))
        self.entry_m1 = Entry(master,
                              validate="key",
                              validatecommand=(vcmd, '%P', 'm1'))
        self.entry_m2 = Entry(master,
                              validate="key",
                              validatecommand=(vcmd, '%P', 'm2'))
        self.entry_y1 = Entry(master,
                              validate="key",
                              validatecommand=(vcmd, '%P', 'y1'))
        self.entry_y2 = Entry(master,
                              validate="key",
                              validatecommand=(vcmd, '%P', 'y2'))
        self.entry_slowMA = Entry(master,
                                  validate="key",
                                  validatecommand=(vcmd, '%P', 'slowMA'))
        self.entry_fastMA = Entry(master,
                                  validate="key",
                                  validatecommand=(vcmd, '%P', 'fastMA'))
        self.plot_button = Button(master,
                                  text="Plot",
                                  command=lambda: self.plot())
        self.MansfieldVar = IntVar()
        #enable Mansfield as default
        self.MansfieldVar.set(1)
        self.mansfieldCheckBox = Checkbutton(master, text="Mansfield RSI", variable = self.MansfieldVar, onvalue = 1,\
                                offvalue=0)
        self.niftyOverlayVar = IntVar()
        self.niftyOverlayVar.set(1)
        self.niftyOverlayCheckBox = Checkbutton(master, text="Nifty Overlay", variable = self.niftyOverlayVar, onvalue = 1,\
                                offvalue=0)

        # Layout
        self.label_stock.grid(row=1, column=1)
        self.entry_stock.grid(row=1, column=2)
        self.label_month.grid(row=2, column=2)
        self.label_date.grid(row=2, column=3)
        self.label_year.grid(row=2, column=4)
        self.label_endDate.grid(row=4, column=1)
        self.label_startDate.grid(row=3, column=1)
        self.plot_button.grid(row=1, column=4)
        self.entry_m1.grid(row=3, column=2)
        self.entry_m2.grid(row=4, column=2)
        self.entry_d1.grid(row=3, column=3)
        self.entry_d2.grid(row=4, column=3)
        self.entry_y1.grid(row=3, column=4)
        self.entry_y2.grid(row=4, column=4)
        self.label_slowMA.grid(row=5, column=1)
        self.entry_slowMA.grid(row=5, column=2)
        self.label_fastMA.grid(row=5, column=3)
        self.entry_fastMA.grid(row=5, column=4)
        self.mansfieldCheckBox.grid(row=6, column=4)
        self.niftyOverlayCheckBox.grid(row=6, column=3)

        # set some default values
        self.entry_stock.insert(0, 'ASHOKLEY.NS')
        self.entry_d1.insert(0, 20)
        self.entry_m1.insert(0, 5)
        self.entry_y1.insert(0, 2016)
        self.entry_d2.insert(0, 19)
        self.entry_m2.insert(0, 6)
        self.entry_y2.insert(0, 2017)
        self.entry_slowMA.insert(0, 30)
        self.entry_fastMA.insert(0, 150)
Ejemplo n.º 10
0
    def listbox():
        attendcelist = []

        curser.execute("use cs350deneme")
        sql_select = """select * from attendance2 where cid=%s"""
        curser.execute(sql_select, (e2.get(), ))
        r = curser.fetchall()
        for i in r:
            cid = str(i[0])
            start = str(i[1])
            sid = str(i[2])
            attended = str(i[3])
            sign = str(i[4])
            tolistbox = cid + " | " + start + " | " + sid + " | " + attended + " | " + sign
            attendcelist.append(tolistbox)
            #print attendcelist

        def deneme():
            datelist = []

            curser.execute("use cs350deneme")
            sql_select = """select * from attendance2 where cid=%s and start like %s"""
            value = e3.get() + "%"
            curser.execute(sql_select, (e2.get(), value))
            r = curser.fetchall()
            for i in r:
                cid = str(i[0])
                start = str(i[1])
                sid = str(i[2])
                attended = str(i[3])
                sign = str(i[4])
                tolistbox = cid + " | " + start + " | " + sid + " | " + attended + " | " + sign
                datelist.append(tolistbox)
                # print attendcelist
            for i in datelist:
                listbox1.insert(END, i)

        listbox = Listbox(coursereport, width=60, height=10, font=("bold", 15))
        listbox.insert(END, )
        listbox1 = Listbox(coursereport,
                           width=60,
                           height=10,
                           font=("bold", 15))
        listbox1.insert(END, )
        scrollbar = Scrollbar(
            coursereport,
            orient="vertical",
        )
        scrollbar.config(command=listbox.yview)
        scrollbar.place(x=1150, y=150, height=242)
        scrollbar1 = Scrollbar(
            coursereport,
            orient="vertical",
        )
        scrollbar1.config(command=listbox1.yview)
        scrollbar1.place(x=1150, y=400, height=242)
        listbox.config(yscrollcommand=scrollbar.set)
        listbox.place(
            x=500,
            y=150,
        )
        listbox1.config(yscrollcommand=scrollbar1.set)
        listbox1.place(
            x=500,
            y=400,
        )

        lb3 = Label(coursereport, text="Date :", font=("bold", 15))
        lb3.place(x=90, y=400)
        e3 = Entry(coursereport,
                   width=10,
                   font=("bold", 15),
                   highlightthickness=2)
        e3.place(x=220, y=400)
        searchbutton1 = Button(coursereport,
                               text="SEARCH",
                               width=10,
                               height=1,
                               bg="turquoise4",
                               fg="white",
                               font="5",
                               relief=RAISED,
                               overrelief=RIDGE,
                               command=deneme)
        searchbutton1.place(x=350, y=400)

        for item in attendcelist:

            listbox.insert(END, item)

        for i in range(len(attendcelist)):
            st = int(attendcelist[i][-1])
            if st == 0:
                listbox.itemconfig(i, {'bg': 'red'})
            else:
                listbox.itemconfig(i, {'bg': 'green'})
    def __init__(self, serial_link):

        # Basic definitions for the GUI components.

        self.window = Tk()
        self.lang = EpiLang()
        self.serial_link = serial_link
        self.serial_link.set_gui_link(self)

        # GUI elements present on all pages.

        self.minions =  [[0 for x in xrange(10)] for y in xrange(10)]
        
        for x in range(10):
            for y in range(10):
                n=((y * 10) + x)
                if (n < 10): n = "0" + str(n)
                self.minions[x][y] = Button(self.window, text = n,
                    command = lambda n1 = n: self.click_minion(n1))
                self.minions[x][y].grid(column = x, row = y)
                
        self.inf_reported = [0 for x in range(100)]
        self.rec_reported = [0 for x in range(100)]

        self.b_setMaster = Button(self.window, text = self.lang.set_master_mb, command = self.click_set_master)
        self.b_sendParams = Button(self.window, text = self.lang.send_params, command = self.click_send_params)
        self.b_seedEpidemic = Button(self.window, text = self.lang.seed_epi, command = self.click_seed_epi)
        self.b_resetEpidemic = Button(self.window, text = self.lang.reset_epi, command = self.click_reset_epi)

        self.l_task = Label(self.window, text = self.lang.current_task)
        self.st_font = tkFont.Font(family = "Calibri", size = 10)
        self.st_instruct = tkst.ScrolledText(self.window, width = 30, height = 5, font = self.st_font,
                                        wrap = 'word', state = 'disabled')


        self.l_task.grid(column = 0, row = 13, columnspan = 10)
        self.st_instruct.grid(column=0, row = 14, columnspan = 10)


        # GUI elements for the Micro:Bit master selection page

        self.l_port = Label(self.window, text = self.lang.using_port)
        self.cb_masters = Combobox(self.window, state = 'readonly')
        self.cb_masters.bind("<<ComboboxSelected>>", self.serial_link.get_master_info)
        self.cb_masters_double_click = 0
        self.b_rescan = Button(self.window, text = self.lang.rescan,
            command = self.serial_link.refresh_microbit_comports)
        self.l_software = Label(self.window, text = self.lang.software)
        self.sv_software = StringVar()
        self.sv_software.set("")
        self.l_software2 = Label(self.window, textvariable = self.sv_software)

        self.l_serialno = Label(self.window, text = self.lang.serial_no)
        self.sv_serialno = StringVar()
        self.l_serialno2 = Label(self.window, textvariable = self.sv_serialno)
        self.l_mbitver = Label(self.window, text = self.lang.mb_version)
        self.sv_mbitver = StringVar()
        self.l_mbitver2 = Label(self.window, textvariable = self.sv_mbitver)

        # GUI elements for the parameter settings page

        self.l_epidno = Label(self.window, text = self.lang.epi_id)
        self.sv_epidno = StringVar()
        self.e_epidno = Entry(self.window, textvariable = self.sv_epidno)
        self.l_epidconst = Label(self.window, textvariable = self.sv_epidno, font=('Arial', 12, 'bold'))

        self.l_paramset = Label(self.window, text = self.lang.saved_params)
        self.cb_paramset = Combobox(self.window, state = 'readonly')
        self.b_save_pset = Button(self.window, text = self.lang.save, command = self.save_params)
        self.b_del_pset = Button(self.window, text = self.lang.delete, command = self.del_params)
        self.b_saveas_pset = Button(self.window, text = self.lang.save_as, command = self.saveas_params)

        self.l_r0 = Label(self.window, text = self.lang.R0)
        self.sv_r0 = StringVar()
        self.e_r0 = Entry(self.window, textvariable = self.sv_r0)
        self.l_rtype = Label(self.window, text = self.lang.R_type)
        self.cb_rtype = Combobox(self.window, state = 'readonly')
        self.l_poimin = Label(self.window, text = self.lang.poi_min);
        self.cb_poimin = Combobox(self.window, state = 'readonly')
        self.l_poimax = Label(self.window, text = self.lang.poi_max);
        self.cb_poimax = Combobox(self.window, state = 'readonly')

        self.l_rpower = Label(self.window, text = self.lang.transmit_range)
        self.cb_rpower = Combobox(self.window, state = 'readonly')
        self.l_exposure = Label(self.window, text = self.lang.exposure)
        self.cb_exposure = Combobox(self.window, state = 'readonly')
        self.l_btrans = Label(self.window, text = self.lang.transmit_button)
        self.cb_btrans = Combobox(self.window, state = 'readonly')
        self.l_brec = Label(self.window, text = self.lang.receive_button)
        self.cb_brec = Combobox(self.window, state = 'readonly')
        self.l_icons = Label(self.window, text = self.lang.icon_set)
        self.cb_icons = Combobox(self.window, state = 'readonly')

        self.cb_rtype['values'] = [self.lang.constant, self.lang.poisson]
        self.cb_rpower['values'] = range(0, 8)
        self.cb_exposure['values'] = [1, 5, 10, 20, 30, 40, 50, 60, 90, 120, 150, 180, 210, 240, 270, 300, 360, 420, 480, 540, 600]
        self.cb_poimin['values'] = range(0, 99)
        self.cb_poimax['values'] = range(1, 100)
        self.cb_btrans['values'] = ['Auto','A','B','A+B']
        self.cb_brec['values'] = ['Auto','A','B','A+B']
        self.cb_icons['values'] = ['SIR', 'I+R', '-I-']

        self.cb_poimin.bind("<<ComboboxSelected>>", self.change_poimin)
        self.cb_poimax.bind("<<ComboboxSelected>>", self.change_poimax)
        self.cb_paramset.bind("<<ComboboxSelected>>", self.change_paramset)
        self.remember_paramset = -1
        self.cb_rtype.bind("<<ComboboxSelected>>", self.set_params_unsaved)
        self.cb_rpower.bind("<<ComboboxSelected>>", self.set_params_unsaved)
        self.cb_exposure.bind("<<ComboboxSelected>>", self.set_params_unsaved)
        self.cb_btrans.bind("<<ComboboxSelected>>", self.set_params_unsaved)
        self.cb_brec.bind("<<ComboboxSelected>>", self.set_params_unsaved)
        self.cb_icons.bind("<<ComboboxSelected>>", self.set_params_unsaved)
        self.e_r0.bind("<Key>", self.set_params_unsaved)

        # Gui Elements for the Seeding / Progress Page

        self.l_seedid = Label(self.window, text = "Victim:")
        self.sv_seedid = StringVar()
        self.l_seedid2 = Label(self.window, textvariable = self.sv_seedid)
        self.b_rndseed = Button(self.window, text = 'Random', command = self.click_random_minion)
        self.l_forcer = Label(self.window, text = "Force contacts")
        self.iv_forcer = IntVar()
        self.iv_forcer.set(1)
        self.tb_forcer = Checkbutton(self.window, text="", variable = self.iv_forcer, command=self.click_forcer)
        self.l_ncons = Label(self.window, text = "No. contacts")
        self.cb_forcer = Combobox(self.window, state = 'readonly')

        self.l_susc = Label(self.window, text = "Susceptible:")
        self.sv_susc = StringVar()
        self.l_susc2 = Label(self.window, textvariable = self.sv_susc)
        self.l_inf = Label(self.window, text="Infected:")
        self.sv_inf = StringVar()
        self.l_inf2 = Label(self.window, textvariable = self.sv_inf)
        self.l_recov = Label(self.window, text = "Recovered:")
        self.sv_recov = StringVar()
        self.l_recov2 = Label(self.window, textvariable = self.sv_recov)

        self.cb_forcer['values'] = range(1,100)
        self.cb_forcer.current(3)
        
        self.b_screen_off = Button(self.window, text = "Screens OFF", command = self.click_screens_off)
        self.b_screen_on = Button(self.window, text = "Screens ON", command = self.click_screens_on)
        

        # Load the previously-saved configurations

        self.paramsets = []
        self.p_r0 = []
        self.p_rtype = []
        self.p_poimin = []
        self.p_poimax = []
        self.p_rpower = []
        self.p_exposure = []
        self.p_btrans = []
        self.p_brec = []
        self.p_icons = []

        self.load_defaults()
        self.sv_epidno.set(self.CURRENT_EPI_ID)

        # Window specific stuff. Set what happens on exit
        # Set the size, title, and application icon for the window.

        self.window.protocol("WM_DELETE_WINDOW", self.ask_quit)
        self.window.title(self.lang.title)
        self.window.geometry("640x480")
        imgicon = PhotoImage(file = os.path.join('microepi.gif'))
        self.window.tk.call('wm', 'iconphoto', self.window._w, imgicon)

        # Show first interface

        self.show_first_interface()

        self.window.mainloop()
Ejemplo n.º 12
0
def student_report():
    def report():
        curser.execute("use cs350deneme")
        sql_search = """select cid from enroll where sid =%s"""
        curser.execute(sql_search, (e1.get(), ))
        results = curser.fetchall()
        course_list = []
        for i in results:
            course_list.append(str(i[0]))

        lb2 = Label(studentreport, text="Enrolled Classes", font=("bold", 15))
        lb2.place(x=90, y=100)
        for x in range(len(course_list)):
            global compButton
            compButton = Button(studentreport,
                                text=course_list[x],
                                width=10,
                                height=1,
                                bg="turquoise4",
                                fg="white",
                                font="5",
                                relief=RAISED,
                                overrelief=RIDGE,
                                command=lambda z=course_list[x]: listbox(z))
            compButton.place(x=200, y=x * 100 + 150)

    def listbox(x):
        attendcelist = []
        curser.execute("use cs350deneme")
        sql_select = """select cid,start,sid,attended,sign from attendance2 where cid=%s and sid =%s"""
        curser.execute(sql_select, (
            x,
            e1.get(),
        ))
        r = curser.fetchall()
        for i in r:
            cid = str(i[0])
            start = str(i[1])
            sid = str(i[2])
            attended = str(i[3])
            sign = str(i[4])
            tolistbox = cid + " | " + start + " | " + sid + " | " + attended + " | " + sign
            attendcelist.append(tolistbox)

        listbox = Listbox(studentreport,
                          width=60,
                          height=10,
                          font=("bold", 15))
        listbox.insert(END, )
        scrollbar = Scrollbar(
            studentreport,
            orient="vertical",
        )
        scrollbar.config(command=listbox.yview)
        scrollbar.place(x=1150, y=150, height=242)
        listbox.config(yscrollcommand=scrollbar.set)
        for item in attendcelist:
            listbox.insert(END, item)
        st = 0
        for i in range(len(attendcelist)):
            print type(attendcelist[i][-1])
            if attendcelist[i][-1] == "e":
                st = 0
            else:
                st = int(attendcelist[i][-1])
            print st
            print type(st)
            if st == 0:
                listbox.itemconfig(i, {'bg': 'red'})
            else:
                listbox.itemconfig(i, {'bg': 'green'})

        # this changes the font color of the 4th item

        listbox.place(
            x=500,
            y=150,
        )

    R2.destroy()
    global studentreport
    studentreport = Toplevel(main_screen)
    studentreport.title("SEARCH AND REPORT")
    studentreport.geometry("1280x720")
    lb1 = Label(studentreport, text="Student No :", font=("bold", 15))
    lb1.place(x=90, y=50)
    e1 = Entry(studentreport,
               width=10,
               font=("bold", 15),
               highlightthickness=2)
    e1.place(x=220, y=50)
    searchbutton = Button(studentreport,
                          text="SEARCH",
                          width=10,
                          height=1,
                          bg="turquoise4",
                          fg="white",
                          font="5",
                          relief=RAISED,
                          overrelief=RIDGE,
                          command=report)
    searchbutton.place(x=350, y=50)

    def back():
        studentreport.destroy()
        home()

    b1 = Button(studentreport,
                text="Back",
                bg="turquoise4",
                fg="white",
                command=back)
    b1.place(x=1210, y=20)
Ejemplo n.º 13
0
def login():
    getuser()
    main_screen.withdraw()

    def getusername(sid):
        curser.execute("use CS350deneme")
        sql_select = """select sid,snameuser,password from users where sid = %s"""
        curser.execute(sql_select, (sid, ))
        record = curser.fetchall()
        return record[0]

    def login_verify():
        global username1
        username1 = username_verify.get()
        password1 = password_verify.get()

        if username1 == "admin" and password1 == "123":
            login_check("Welcome Admin", home)
        elif username1 in users_dict.keys(
        ) and password1 == users_dict[username1]:
            login_check("Welcome" + "  " + getusername(username1)[1],
                        studenthome)
        else:

            tkMessageBox.showerror("INVALID ENTRY",
                                   "Username or password is wrong")

    global login_screen
    login_screen = Toplevel(main_screen)
    login_screen.title("Login")
    login_screen.geometry("385x650")
    login_screen.resizable(width=FALSE, height=FALSE)
    login_screen.configure(background="white")

    global username_verify
    global password_verify
    username_verify = StringVar()
    password_verify = StringVar()
    global username_login_entry
    global password_login_entry
    path = "JPG_Formatinda_SEHIR_logo_1_Ingilizce.jpg"
    img = ImageTk.PhotoImage(Image.open(path))
    panel = Label(login_screen, image=img)
    panel.photo = img
    panel.place(x=40, y=0)
    Label(login_screen, text="Username : "******"bold", 20),
          bg="white").place(x=50, y=490)

    def clear(x):
        username_login_entry.delete(0, END)
        password_login_entry.delete(0, END)

    username_login_entry = Entry(login_screen, textvariable=username_verify)
    username_login_entry.bind('<Button-1>', clear)
    username_login_entry.place(x=210, y=500, height=25, width=120)
    Label(login_screen, text="Password : "******"bold", 20),
          bg="white").place(x=50, y=540)
    password_login_entry = Entry(login_screen,
                                 textvariable=password_verify,
                                 show='*')
    password_login_entry.place(x=210, y=550, height=25, width=120)
    loginB = Button(login_screen,
                    text="Login",
                    width=15,
                    height=1,
                    bg="turquoise4",
                    fg="white",
                    font="5",
                    relief=FLAT,
                    overrelief=RIDGE,
                    borderwidth='5',
                    command=login_verify)
    loginB.place(x=190, y=600)
    ExitB = Button(login_screen,
                   text="Exit",
                   width=13,
                   height=1,
                   bg="turquoise4",
                   fg="white",
                   font="5",
                   relief=FLAT,
                   overrelief=RIDGE,
                   borderwidth='5',
                   command=exit)
    ExitB.place(x=40, y=600)
Ejemplo n.º 14
0
def new_student():
    def clear1(x):
        Student_no.delete(0, END)
        First_name.delete(0, END)
        Last_name.delete(0, END)
        Password.delete(0, END)

    def add_student():
        curser.execute("use CS350deneme")
        print "here"
        try:
            getuser()
            if Student_no.get() in users_dict.keys():
                added.config(text="This Student already added", fg="black")
            else:
                sid = Student_no.get()
                fname = First_name.get()
                lname = Last_name.get()
                password = Password.get()

                curser.execute(
                    """insert into users(sid,snameuser,slastnameuser,password) values(%s,%s,%s,%s)""",
                    (sid, fname, lname, password))

                database.commit()

                added.config(text="Added", fg="black")
        except:
            added.config(text="something went wrong", fg="red")

    R2.destroy()
    global R6
    R6 = Toplevel(main_screen)
    R6.resizable(width=FALSE, height=FALSE)
    R6.geometry("385x650")
    R6.title('MAKE ATTENDENCE ENTRY')
    lb1 = Label(R6, text="Student_NO :", font=("bold", 15))
    lb1.place(x=50, y=206)
    lb2 = Label(R6, text="FirstName :", font=("bold", 15))
    lb2.place(x=50, y=280)
    lb3 = Label(R6, text="LastName :", font=("bold", 15))
    lb3.place(x=50, y=350)
    lb4 = Label(R6, text="Password :"******"bold", 15))
    lb4.place(x=50, y=420)
    global Student_no
    global First_name
    global Last_name
    global Password
    Student_no = Entry(R6, width=15, font=("bold", 15), highlightthickness=2)
    Student_no.place(x=180, y=206)
    Student_no.bind('<Button-1>', clear1)
    First_name = Entry(R6, width=15, font=("bold", 15), highlightthickness=2)
    First_name.place(x=180, y=280)
    Last_name = Entry(R6, width=15, font=("bold", 15), highlightthickness=2)
    Last_name.place(x=180, y=350)
    Password = Entry(R6, width=15, font=("bold", 15), highlightthickness=2)
    Password.place(x=180, y=420)

    Addbutton = Button(R6,
                       text="ADD",
                       width=32,
                       height=2,
                       bg="turquoise4",
                       fg="white",
                       font="5",
                       relief=RAISED,
                       overrelief=RIDGE,
                       command=add_student)
    Addbutton.place(x=50, y=500)

    def back():
        R6.destroy()
        home()

    back = Button(R6, text="HOME", bg="turquoise4", fg="white", command=back)
    back.place(x=300, y=30)
    added = Label(R6, font=("bold", 15))
    added.place(x=50, y=600)
Ejemplo n.º 15
0
## Activity 1
from Tkinter import Tk, Label, Entry, Button, StringVar
from tkMessageBox import showinfo

my_app = Tk(className='Personal Data')

L1 = Label(my_app, text='Personal Data', font=('Arial', 24))
L1.grid(row=0, column=0)

L2 = Label(my_app, text='Name')
L2.grid(row=1, column=0)
str2 = StringVar(value='Aulia S.R Nurcahyani')
E2 = Entry(my_app, textvariable=str2)
E2.grid(row=1, column=1)

L3 = Label(my_app, text='NIM')
L3.grid(row=2, column=0)
str3 = StringVar(value='L200183070')
E3 = Entry(my_app, textvariable=str3)
E3.grid(row=2, column=1)

L4 = Label(my_app, text='Favourite Book')
L4.grid(row=3, column=0)
str4 = StringVar(value='Spring in London')
E4 = Entry(my_app, textvariable=str4)
E4.grid(row=3, column=1)

L5 = Label(my_app, text='Idol among Friends')
L5.grid(row=4, column=0)
str5 = StringVar(value='Umar bin Khattab')
E5 = Entry(my_app, textvariable=str5)
Ejemplo n.º 16
0
    def __init__(self, master):
        self.master = master
        master.title('GDELT News Analysis')

        ### To create buttons and text fields

        self.id_label = Label(master, text="GDELT GKG Database")

        self.date_download = Label(master, text="DOWNLOAD GKG DATA FROM 1 DAY")

        self.date_field = Label(
            master,
            text="Please enter the day you want to download below: (YYYYMMDD)")
        self.date_entry = Entry(master)
        self.download_button = Button(master,
                                      text="Download",
                                      command=self.download)

        self.multiple_date_download = Label(
            master, text="DOWNLOAD GKG DATA FROM A DATE RANGE")
        self.multiple_date_field_start = Label(
            master,
            text="Please enter the day you want to start downloading from:")
        self.multiple_date_entry_start = Entry(master)
        self.multiple_date_field_end = Label(
            master,
            text="Please enter the day you wish to stop downloading at:")
        self.multiple_date_entry_end = Entry(master)
        self.multiple_download_button = Button(master,
                                               text="Download",
                                               command=self.multiple_download)

        self.analyze_field = Label(
            master,
            text=
            "Please enter the day you would like to get geographic data for: (YYYYMMDD)"
        )
        self.analyze_entry = Entry(master)
        self.analyze_keyword = Label(
            master, text="Please enter the text you would like to analyze:")
        self.keyword = StringVar()
        self.keyword.set("")
        self.keyword_entry = OptionMenu(
            master, self.keyword, "ENV_DEFORESTATION", "WB_1980_AGRO_FORESTRY",
            "WB_1057_SUSTAINABLE_FOREST_MANAGEMENT", "WATER_SECURITY",
            "ENV_SPECIESENDANGERED")
        self.analyze_button = Button(master,
                                     text="Analyze",
                                     command=self.get_latlong)

        self.leadership_field = Label(
            master,
            text="Analyze the leading actors in the space on a SINGLE date")
        self.leadership_entry_field = Label(
            master,
            text=
            "Please enter the day you would like to get leadership data for: (YYYYMMDD)"
        )
        self.leadership_entry = Entry(master)
        self.leadership_analyze = Label(
            master, text="Please select the text you would like to analyze:")
        self.leadership_keyword = StringVar()
        self.leadership_keyword.set("")
        self.leadership_keyword_entry = OptionMenu(
            master, self.leadership_keyword, "ENV_DEFORESTATION",
            "WB_1980_AGRO_FORESTRY", "WB_1057_SUSTAINABLE_FOREST_MANAGEMENT",
            "WATER_SECURITY")
        self.leadership_analyze_button = Button(master,
                                                text="Analyze",
                                                command=self.get_leadership)

        self.multiple_leadership_field = Label(
            master,
            text="Analyzing leading actors in the space on a date RANGE")
        self.multiple_leadership_field_start = Label(
            master,
            text="Please enter the day you want to start downlaoding from:")
        self.multiple_leadership_entry_start = Entry(master)
        self.multiple_leadership_field_end = Label(
            master,
            text="Please enter the day you wish to stop downloading at:")
        self.multiple_leadership_entry_end = Entry(master)
        self.multiple_leadership_analyze = Label(
            master, text="Please select the text you would like to analyze:")
        self.multiple_leadership_keyword = StringVar()
        self.multiple_leadership_keyword.set("")
        self.multiple_leadership_keyword_entry = OptionMenu(
            master, self.multiple_leadership_keyword, "ENV_DEFORESTATION",
            "WB_1980_AGRO_FORESTRY", "WB_1057_SUSTAINABLE_FOREST_MANAGEMENT",
            "WATER_SECURITY")
        self.multiple_leadership_analyze_button = Button(
            master, text="Analyze", command=self.get_multiple_leadership)

        ### To arrange buttons and text fields in window

        self.id_label.grid(row=0, column=0)
        self.date_field.grid(row=2, column=0)
        self.date_entry.grid(row=2, column=2)
        self.download_button.grid(row=3, column=2)
        self.multiple_date_download.grid(row=4, column=0)
        self.multiple_date_field_start.grid(row=5, column=0)
        self.multiple_date_entry_start.grid(row=5, column=2)
        self.multiple_date_field_end.grid(row=6, column=0)
        self.multiple_date_entry_end.grid(row=6, column=2)
        self.multiple_download_button.grid(row=7, column=2)
        self.analyze_field.grid(row=8, column=0)
        self.analyze_entry.grid(row=8, column=2)
        self.analyze_keyword.grid(row=9, column=0)
        self.keyword_entry.grid(row=9, column=2)
        self.analyze_button.grid(row=10, column=2)
        self.leadership_field.grid(row=11, column=0)
        self.leadership_entry_field.grid(row=12, column=0)
        self.leadership_entry.grid(row=12, column=2)
        self.leadership_analyze.grid(row=13, column=0)
        self.leadership_keyword_entry.grid(row=13, column=2)
        self.leadership_analyze_button.grid(row=14, column=2)
        self.multiple_leadership_field.grid(row=15, column=0)
        self.multiple_leadership_field_start.grid(row=16, column=0)
        self.multiple_leadership_entry_start.grid(row=16, column=2)
        self.multiple_leadership_field_end.grid(row=17, column=0)
        self.multiple_leadership_entry_end.grid(row=17, column=2)
        self.multiple_leadership_analyze.grid(row=18, column=0)
        self.multiple_leadership_keyword_entry.grid(row=18, column=2)
        self.multiple_leadership_analyze_button.grid(row=19, column=2)
Ejemplo n.º 17
0
    def createGUI(self):

        self.window = Tk()
        self.window.title("Camera Control")

        cur_row = 0
        self.camera = []
        self.camera_entry = []
        self.exposure = []
        self.exposure_entry = []
        for i in range(int(self.number_of_cams.get())):
            # drop down menu to select camera
            Label(self.window,
                  text="Camera " + str(i + 1) + ": ").grid(sticky="w",
                                                           row=cur_row,
                                                           column=0)
            self.camera.append(StringVar())
            self.camera_entry.append(
                ttk.Combobox(self.window, textvariable=self.camera[i]))
            self.camera_entry[i]['values'] = self.cam_names
            self.camera_entry[i].current(i)
            self.camera_entry[i].grid(row=cur_row, column=1)

            # inialize camera button
            if i == 0:
                Button(self.window,
                       text="Initialize Camera 1",
                       command=lambda: self.init_cam(0)).grid(sticky="nsew",
                                                              row=cur_row + 1,
                                                              column=0,
                                                              columnspan=2)
            elif i == 1:
                Button(self.window,
                       text="Initialize Camera 2",
                       command=lambda: self.init_cam(1)).grid(sticky="nsew",
                                                              row=cur_row + 1,
                                                              column=0,
                                                              columnspan=2)
            elif i == 2:
                Button(self.window,
                       text="Initialize Camera 3",
                       command=lambda: self.init_cam(2)).grid(sticky="nsew",
                                                              row=cur_row + 1,
                                                              column=0,
                                                              columnspan=2)

            # change exposure
            self.exposure.append(StringVar())
            self.exposure_entry.append(
                Entry(self.window, textvariable=self.exposure[i]))
            self.exposure_entry[i].grid(sticky="nsew", row=cur_row, column=2)
            if i == 0:
                Button(self.window,
                       text="Set Exposure 1",
                       command=lambda: self.set_exposure(0)).grid(
                           sticky="nsew", row=cur_row + 1, column=2)
            elif i == 1:
                Button(self.window,
                       text="Set Exposure 2",
                       command=lambda: self.set_exposure(1)).grid(
                           sticky="nsew", row=cur_row + 1, column=2)
            elif i == 2:
                Button(self.window,
                       text="Set Exposure 3",
                       command=lambda: self.set_exposure(2)).grid(
                           sticky="nsew", row=cur_row + 1, column=2)

            # empty row
            Label(self.window, text="").grid(row=cur_row + 2, column=0)

            # end of camera loop
            cur_row = cur_row + 3

        # Labview Channel
        Label(self.window, text="Labview Channel: ").grid(sticky="w",
                                                          row=cur_row,
                                                          column=0)
        self.labview_channel = StringVar(value="")
        self.labview_channel_entry = ttk.Combobox(
            self.window, textvariable=self.labview_channel)
        self.labview_channel_entry['values'] = tuple(self.labview_channel_list)
        self.labview_channel_entry.grid(sticky="nsew", row=cur_row, column=1)
        Button(self.window,
               text="Initialize Labview",
               command=self.init_labview).grid(sticky="nsew",
                                               row=cur_row + 1,
                                               column=0,
                                               columnspan=2)
        Button(self.window, text="End LV",
               command=self.end_labview).grid(sticky="nsew",
                                              row=cur_row + 1,
                                              column=2)
        cur_row += 2

        # empty row
        Label(self.window, text="").grid(row=cur_row, column=0)
        cur_row += 1

        # subject name
        Label(self.window, text="Subject: ").grid(sticky="w",
                                                  row=cur_row,
                                                  column=0)
        self.subject = StringVar()
        self.subject_entry = ttk.Combobox(self.window,
                                          textvariable=self.subject)
        self.subject_entry['values'] = tuple(self.mouse_list)
        self.subject_entry.grid(row=cur_row, column=1)
        cur_row += 1

        # attempt
        Label(self.window, text="Attempt: ").grid(sticky="w",
                                                  row=cur_row,
                                                  column=0)
        self.attempt = StringVar(value="1")
        self.attempt_entry = ttk.Combobox(self.window,
                                          textvariable=self.attempt)
        self.attempt_entry['values'] = tuple(range(1, 10))
        self.attempt_entry.grid(row=cur_row, column=1)
        cur_row += 1

        # type frame rate
        Label(self.window, text="Frame Rate: ").grid(sticky="w",
                                                     row=cur_row,
                                                     column=0)
        self.fps = StringVar()
        self.fps_entry = Entry(self.window, textvariable=self.fps)
        self.fps_entry.insert(END, '100')
        self.fps_entry.grid(sticky="nsew", row=cur_row, column=1)
        cur_row += 1

        # output directory
        Label(self.window, text="Output Directory: ").grid(sticky="w",
                                                           row=cur_row,
                                                           column=0)
        self.output = StringVar()
        self.output_entry = ttk.Combobox(self.window, textvariable=self.output)
        self.output_entry['values'] = self.output_dir
        self.output_entry.grid(row=cur_row, column=1)
        Button(self.window, text="Browse",
               command=self.browse_output).grid(sticky="nsew",
                                                row=cur_row,
                                                column=2)
        cur_row += 1

        # set up video
        Button(self.window, text="Set Up Video",
               command=self.set_up_vid).grid(sticky="nsew",
                                             row=cur_row,
                                             column=0,
                                             columnspan=2)
        cur_row += 1

        Label(self.window, text="Current :: ").grid(row=cur_row,
                                                    column=0,
                                                    sticky="w")
        self.current_file_label = Label(self.window, text="")
        self.current_file_label.grid(row=cur_row, column=1, sticky="w")
        cur_row += 1

        # empty row
        Label(self.window, text="").grid(row=cur_row, column=0)
        cur_row += 1

        # record button
        Label(self.window, text="Record: ").grid(sticky="w",
                                                 row=cur_row,
                                                 column=0)
        self.record_on = IntVar(value=0)
        self.button_on = Radiobutton(self.window,
                                     text="On",
                                     selectcolor='green',
                                     indicatoron=0,
                                     variable=self.record_on,
                                     value=1,
                                     command=self.start_record).grid(
                                         sticky="nsew", row=cur_row, column=1)
        self.button_off = Radiobutton(self.window,
                                      text="Off",
                                      selectcolor='red',
                                      indicatoron=0,
                                      variable=self.record_on,
                                      value=0).grid(sticky="nsew",
                                                    row=cur_row + 1,
                                                    column=1)
        self.release_vid0 = Button(
            self.window,
            text="Save Video",
            command=lambda: self.save_vid(compress=False)).grid(sticky="nsew",
                                                                row=cur_row,
                                                                column=2)
        self.release_vid1 = Button(
            self.window,
            text="Compress & Save Video",
            command=lambda: self.save_vid(compress=True)).grid(sticky="nsew",
                                                               row=cur_row + 1,
                                                               column=2)
        self.release_vid2 = Button(
            self.window,
            text="Delete Video",
            command=lambda: self.save_vid(delete=True)).grid(sticky="nsew",
                                                             row=cur_row + 2,
                                                             column=2)
        cur_row += 3

        # close window/reset GUI
        Label(self.window).grid(row=cur_row, column=0)
        self.reset_button = Button(self.window,
                                   text="Reset GUI",
                                   command=self.selectCams).grid(sticky="nsew",
                                                                 row=cur_row +
                                                                 1,
                                                                 column=0,
                                                                 columnspan=2)
        self.close_button = Button(self.window,
                                   text="Close",
                                   command=self.close_window).grid(
                                       sticky="nsew",
                                       row=cur_row + 2,
                                       column=0,
                                       columnspan=2)
Ejemplo n.º 18
0
    def __init__(self, master):
        def updateList():
            for i in range(20):
                # automatic indenting so it all lines up and looks pretty
                numStr = str(i + 1)
                if len(drawers) > 9 and i < 9:
                    numStr = numStr + " "
                if len(drawers) > 99 and i < 99:
                    numStr = numStr + " "

                # translate 0 and 1 into readable text
                if drawers[i][0] == True:
                    lockState = "Locked"
                else:
                    lockState = "Unlocked"

                if drawers[i][1] == True:
                    openState = "Closed"
                else:
                    openState = "Open"

                labelList[i]['text'] = numStr + ": " + lockState + ", " + openState

        # testing stuff
        def entryInput(self):
            entryText = entry_box.get()
            entry_box.delete(0,len(entryText))
            entry_box.insert(0,"")

            action = entryText
            if action[:4] == "open":
                # number parsing
                drawerToOpen = ""
                # length will be 6 if single digit, 7 if double digit
                if len(action) == 7:
                    drawerToOpen = int(action[-2:]) # slicing magic
                else:
                    drawerToOpen = int(action[-1:]) # slicing magic
                drawerToOpen -= 1 # shift one because list starts at 0


                if drawers[drawerToOpen][0] == True:
                    print("Sorry, you can not open this drawer. It is locked.")
                    sleep(2)
                elif drawers[drawerToOpen][1] == False:
                    print("Sorry, you can not open this drawer. It is already open.")
                    sleep(2)
                else:
                    drawers[drawerToOpen][1] = False
                    if drawers[drawerToOpen][4] == False:
                        drawers[newDrawer][4] = True
                clear()
            elif action[:5] == "close":
                # number parsing
                drawerToClose = ""
                # length will be 7 if single digit, 8 if double digit
                if len(action) == 8:
                    drawerToClose = int(action[-2:]) # slicing magic
                else:
                    drawerToClose = int(action[-1:]) # slicing magic
                drawerToClose -= 1 # shift one because list starts at 0


                if drawers[drawerToClose][1] == True:
                    print("Sorry, you can not close this drawer. It is already closed.")
                    sleep(2)
                else:
                    drawers[drawerToClose][1] = True
                    drawers[drawerToClose][0] = True
                    if drawers[drawerToClose][2] == None:
                        drawers[drawerToClose][4] = False # unreserve when a surface is taken out

                        #note: I am a massive idiot. i spent 2 hours trying to find why i wasn't setting the flag to false, when i said flag == false instead of flag = false

                    # lock a drawer after it is closed, because locked is the default state
                    # and it should only be open when a surface is being taken in or out 
                clear()

            elif len(action) == 10:
                drawerToClose = None
                for i in range(len(drawers)):
                    if drawers[i][1] == False:
                        drawerToClose = i
                        break
                if drawerToClose != None:
                    print("Please close drawer number " + str(drawerToClose + 1) + ".")
                else:
                    unlockedDrawer = None
                    for i in range(len(drawers)):
                        if drawers[i][0] == False:
                            unlockedDrawer = i
                            break
                    if unlockedDrawer != None:
                        if drawers[unlockedDrawer][4] == False:
                            print("Please put your surface in drawer number " + str(unlockedDrawer + 1) + ".")
                            drawers[unlockedDrawer][2] = action[-10:] # if a new barcode is scanned when an old drawer is still unlocked and doesn't have a surface in it, repurpose the drawer
                        else:
                            print("Please remove the surface from drawer number " + str(unlockedDrawer + 1) + ".")
                    else:
                        code = action[-10:] # because student ids are always 10 digits
                        removeDrawer = None
                        for i in range(len(drawers)): # check if you are removing or adding
                            if drawers[i][2] == code:
                                removeDrawer = i
                        if removeDrawer == None: # add functionality
                            newDrawer = None
                            # find an open drawer
                            for i in range(len(drawers)):
                                if drawers[i][4] == False:
                                    newDrawer = i
                                    break
                            if newDrawer == None:
                                print("Sorry, all drawers are being used right now.")
                            else:
                                # set information
                                drawers[newDrawer][2] = code
                                # unlock the drawer until it is opened and closed
                                drawers[newDrawer][0] = False
                                print("Please put your surface in drawer number " + str(newDrawer + 1) + ".")
                        else: # remove functionality
                            drawers[removeDrawer][0] = False
                            drawers[removeDrawer][2] = None
                            drawers[removeDrawer][3] = None
                            print("Please remove your surface from drawer number " + str(removeDrawer + 1) + ".")
                sleep(2)
                clear() 
            else:
                clear()

            updateList()
        
        # setup
        master = master
        master.title("Cabinet")

        # create the 20 labels
        labelList = []
        for i in range(20):
            labelList.append(Label(master, text = ""))
            labelList[i].pack()


        # create the textbox
        entry_box = Entry(master)
        entry_box.pack()

        clear()

        # main data structure
        # 0: locked/unlocked status, true = locked, false = unlocked
        # 1: closed/open status, true = closed, false = open
        # 2: Username, None = no user
        # 3: Password, None = no user
        # 4: Flag, True = drawer is reserved, False = drawer is not reserved
        drawers = [ 
        ]

        # populate the list
        for i in range(20):
            drawers.append([
                True,
                True,
                None,
                None,
                False
            ])

        updateList()


        entry_box.bind('<Return>',entryInput)
Ejemplo n.º 19
0
 def __init__(self, master):
     Frame.__init__(self, master, padx=7, pady=7)
     self.unix = StringVar()
     self.unix.set(str(timegm(Datetime.now().timetuple())))
     self.unix.trace('w', lambda a, b, c: master.updateFromUnix())
     Entry(self, width=10, textvariable=self.unix, font=ENTRYFONT).pack()
Ejemplo n.º 20
0
    def __init__(self, master=None):
        Frame.__init__(self, master)

        self.pack()

        # First row
        f1 = LabelFrame(self,
                        text='NAND file with No$GBA footer',
                        padx=10,
                        pady=10)

        # NAND Button
        self.nand_mode = False

        nand_icon = PhotoImage(
            data=('R0lGODlhEAAQAIMAAAAAADMzM2ZmZpmZmczMzP///wAAAAAAAAA'
                  'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAMAAAYALAAAAAAQAB'
                  'AAAARG0MhJaxU4Y2sECAEgikE1CAFRhGMwSMJwBsU6frIgnR/bv'
                  'hTPrWUSDnGw3JGU2xmHrsvyU5xGO8ql6+S0AifPW8kCKpcpEQA7'))

        self.nand_button = Button(f1,
                                  image=nand_icon,
                                  command=self.change_mode,
                                  state=DISABLED)
        self.nand_button.image = nand_icon

        self.nand_button.pack(side='left')

        self.nand_file = StringVar()
        Entry(f1, textvariable=self.nand_file, state='readonly',
              width=40).pack(side='left')

        Button(f1, text='...', command=self.choose_nand).pack(side='left')

        f1.pack(padx=10, pady=10, fill=X)

        # Second row
        f2 = Frame(self)

        # Check box
        self.twilight = IntVar()
        self.twilight.set(1)

        self.chk = Checkbutton(
            f2,
            text='Install latest TWiLight Menu++ on custom firmware',
            variable=self.twilight)

        self.chk.pack(padx=10, anchor=W)

        # NAND operation frame
        self.nand_frame = LabelFrame(f2,
                                     text='NAND operation',
                                     padx=10,
                                     pady=10)

        self.nand_operation = IntVar()
        self.nand_operation.set(0)

        Radiobutton(self.nand_frame,
                    text='Uninstall unlaunch or install v1.4 stable',
                    variable=self.nand_operation,
                    value=0,
                    command=lambda: self.enable_entries(False)).pack(anchor=W)

        Radiobutton(self.nand_frame,
                    text='Remove No$GBA footer',
                    variable=self.nand_operation,
                    value=1,
                    command=lambda: self.enable_entries(False)).pack(anchor=W)

        Radiobutton(self.nand_frame,
                    text='Add No$GBA footer',
                    variable=self.nand_operation,
                    value=2,
                    command=lambda: self.enable_entries(True)).pack(anchor=W)

        fl = Frame(self.nand_frame)

        self.cid_label = Label(fl, text='eMMC CID', state=DISABLED)
        self.cid_label.pack(anchor=W, padx=(24, 0))

        self.cid = StringVar()
        self.cid_entry = Entry(fl,
                               textvariable=self.cid,
                               width=20,
                               state=DISABLED)
        self.cid_entry.pack(anchor=W, padx=(24, 0))

        fl.pack(side='left')

        fr = Frame(self.nand_frame)

        self.console_id_label = Label(fr, text='Console ID', state=DISABLED)
        self.console_id_label.pack(anchor=W)

        self.console_id = StringVar()
        self.console_id_entry = Entry(fr,
                                      textvariable=self.console_id,
                                      width=20,
                                      state=DISABLED)
        self.console_id_entry.pack(anchor=W)

        fr.pack(side='right')

        f2.pack(fill=X)

        # Third row
        f3 = Frame(self)

        self.start_button = Button(f3,
                                   text='Start',
                                   width=16,
                                   command=self.hiya,
                                   state=DISABLED)
        self.start_button.pack(side='left', padx=(0, 5))

        Button(f3, text='Quit', command=root.destroy,
               width=16).pack(side='left', padx=(5, 0))

        f3.pack(pady=(10, 20))

        self.folders = []
        self.files = []
Ejemplo n.º 21
0
    def __init__(self, master):
        self.initComplete = 0
        self.master = master
        self.x, self.y, self.w, self.h = -1, -1, -1, -1

        # bind master to <Configure> in order to handle any resizing, etc.
        # postpone self.master.bind("<Configure>", self.Master_Configure)
        self.master.bind('<Enter>', self.bindConfigure)

        self.master.title("PyHatch GUI")
        self.master.resizable(0, 0)  # Linux may not respect this

        dialogframe = Frame(master, width=810, height=630)
        dialogframe.pack()

        self.Shortdesc_Labelframe = LabelFrame(
            dialogframe,
            text="Short Description (1-liner)",
            height="90",
            width="718")
        self.Shortdesc_Labelframe.place(x=60, y=127)

        helv20 = tkFont.Font(family='Helvetica', size=20, weight='bold')

        self.Buildproject_Button = Button(dialogframe,
                                          text="Build Project",
                                          width="15",
                                          font=helv20)
        self.Buildproject_Button.place(x=492, y=10, width=263, height=68)
        self.Buildproject_Button.bind("<ButtonRelease-1>",
                                      self.Buildproject_Button_Click)

        self.Selectdir_Button = Button(dialogframe,
                                       text="<Select Directory>",
                                       width="15")
        self.Selectdir_Button.place(x=72, y=585, width=672, height=31)
        self.Selectdir_Button.bind("<ButtonRelease-1>",
                                   self.Selectdir_Button_Click)

        self.Author_Entry = Entry(dialogframe, width="15")
        self.Author_Entry.place(x=228, y=424, width=187, height=21)
        self.Author_Entry_StringVar = StringVar()
        self.Author_Entry.configure(textvariable=self.Author_Entry_StringVar)
        self.Author_Entry_StringVar.set("John Doe")

        self.Classname_Entry = Entry(dialogframe, width="15")
        self.Classname_Entry.place(x=192, y=73, width=165, height=21)
        self.Classname_Entry_StringVar = StringVar()
        self.Classname_Entry.configure(
            textvariable=self.Classname_Entry_StringVar)
        self.Classname_Entry_StringVar.set("MyClass")

        self.Copyright_Entry = Entry(dialogframe, width="15")
        self.Copyright_Entry.place(x=228, y=478, width=461, height=21)
        self.Copyright_Entry_StringVar = StringVar()
        self.Copyright_Entry.configure(
            textvariable=self.Copyright_Entry_StringVar)
        self.Copyright_Entry_StringVar.set("Copyright (c) 2013 John Doe")

        self.Email_Entry = Entry(dialogframe, relief="sunken", width="15")
        self.Email_Entry.place(x=228, y=505, width=458, height=21)
        self.Email_Entry_StringVar = StringVar()
        self.Email_Entry.configure(textvariable=self.Email_Entry_StringVar)
        self.Email_Entry_StringVar.set("*****@*****.**")

        self.GithubUserName_Entry = Entry(dialogframe,
                                          relief="sunken",
                                          width="15")
        self.GithubUserName_Entry.place(x=228, y=539, width=458, height=21)
        self.GithubUserName_Entry_StringVar = StringVar()
        self.GithubUserName_Entry.configure(
            textvariable=self.GithubUserName_Entry_StringVar)
        self.GithubUserName_Entry_StringVar.set("github_user_name")

        self.Funcname_Entry = Entry(dialogframe, width="15")
        self.Funcname_Entry.place(x=192, y=100, width=157, height=21)
        self.Funcname_Entry_StringVar = StringVar()
        self.Funcname_Entry.configure(
            textvariable=self.Funcname_Entry_StringVar)
        self.Funcname_Entry_StringVar.set("my_function")

        # License values should be correct format
        LICENSE_OPTIONS = tuple(sorted(CLASSIFIER_D.keys()))
        self.License_Entry_StringVar = StringVar()
        self.License_Entry = OptionMenu(dialogframe,
                                        self.License_Entry_StringVar,
                                        *LICENSE_OPTIONS)
        self.License_Entry.place(x=552, y=424, width=184, height=21)
        self.License_Entry_StringVar.set(LICENSE_OPTIONS[0])

        self.Mainpyname_Entry = Entry(dialogframe, width="15")
        self.Mainpyname_Entry.place(x=168, y=37, width=196, height=21)
        self.Mainpyname_Entry_StringVar = StringVar()
        self.Mainpyname_Entry.configure(
            textvariable=self.Mainpyname_Entry_StringVar)
        self.Mainpyname_Entry_StringVar.set("main.py")

        self.Projname_Entry = Entry(dialogframe, width="15")
        self.Projname_Entry.place(x=168, y=10, width=194, height=21)
        self.Projname_Entry_StringVar = StringVar()
        self.Projname_Entry.configure(
            textvariable=self.Projname_Entry_StringVar)
        self.Projname_Entry_StringVar.set("MyProject")

        self.Shortdesc_Entry = Entry(dialogframe, width="15")
        self.Shortdesc_Entry.place(x=72, y=150, width=688, height=48)
        self.Shortdesc_Entry_StringVar = StringVar()
        self.Shortdesc_Entry.configure(
            textvariable=self.Shortdesc_Entry_StringVar)
        self.Shortdesc_Entry_StringVar.set("My project does this")

        # Status must be correct format
        self.Status_Entry_StringVar = StringVar()
        self.Status_Entry = OptionMenu(dialogframe,
                                       self.Status_Entry_StringVar,
                                       *DEV_STATUS_OPTIONS)
        self.Status_Entry.place(x=228, y=451, width=183, height=21)
        self.Status_Entry_StringVar.set(DEV_STATUS_OPTIONS[0])

        self.Version_Entry = Entry(dialogframe, width="15")
        self.Version_Entry.place(x=552, y=451, width=184, height=21)
        self.Version_Entry_StringVar = StringVar()
        self.Version_Entry.configure(textvariable=self.Version_Entry_StringVar)
        self.Version_Entry_StringVar.set("0.1.1")

        self.Author_Label = Label(dialogframe, text="Author", width="15")
        self.Author_Label.place(x=96, y=424, width=112, height=22)

        self.Classname_Label = Label(dialogframe,
                                     text="Class Name",
                                     width="15")
        self.Classname_Label.place(x=60, y=73, width=112, height=22)

        self.Copyright_Label = Label(dialogframe, text="Copyright", width="15")
        self.Copyright_Label.place(x=96, y=478, width=113, height=23)

        self.Email_Label = Label(dialogframe, text="Email", width="15")
        self.Email_Label.place(x=96, y=505, width=113, height=23)

        self.GithubUserName_Label = Label(dialogframe,
                                          text="GithubUserName",
                                          width="15")
        self.GithubUserName_Label.place(x=96, y=539, width=113, height=23)

        self.Funcname_Label = Label(dialogframe,
                                    text="Function Name",
                                    width="15")
        self.Funcname_Label.place(x=60, y=100, width=112, height=22)

        self.License_Label = Label(dialogframe, text="License", width="15")
        self.License_Label.place(x=432, y=424, width=113, height=23)

        self.Longdesc_Label = Label(dialogframe,
                                    text="Paragraph Description",
                                    width="15")
        self.Longdesc_Label.place(x=216, y=220, width=376, height=22)

        self.Mainpyname_Label = Label(dialogframe,
                                      text="Main Python File",
                                      width="15")
        self.Mainpyname_Label.place(x=48, y=37, width=112, height=22)

        self.Projname_Label = Label(dialogframe,
                                    text="Project Name",
                                    width="15")
        self.Projname_Label.place(x=48, y=10, width=112, height=22)

        self.Selectdir_Label = Label(
            dialogframe,
            text="Select the Directory Below Which to Place Your Project",
            width="15")
        self.Selectdir_Label.place(x=156, y=567, width=536, height=24)

        self.Status_Label = Label(dialogframe, text="Status", width="15")
        self.Status_Label.place(x=96, y=451, width=114, height=24)

        self.Version_Label = Label(dialogframe, text="Version", width="15")
        self.Version_Label.place(x=432, y=451, width=113, height=23)

        self.Isclass_Radiobutton = Radiobutton(dialogframe,
                                               text="Class Project",
                                               value="Class Project",
                                               width="15",
                                               anchor=W)
        self.Isclass_Radiobutton.place(x=320, y=73, width=135, height=27)
        self.RadioGroup1_StringVar = StringVar()
        self.RadioGroup1_StringVar.set("Class Project")
        self.RadioGroup1_StringVar_traceName = \
            self.RadioGroup1_StringVar.trace_variable("w",
                                                      self.RadioGroup1_StringVar_Callback)
        self.Isclass_Radiobutton.configure(variable=self.RadioGroup1_StringVar)

        self.Isfunction_Radiobutton = Radiobutton(dialogframe,
                                                  text="Function Project",
                                                  value="Function Project",
                                                  width="15",
                                                  anchor=W)
        self.Isfunction_Radiobutton.place(x=320, y=100, width=135, height=27)
        self.Isfunction_Radiobutton.configure(
            variable=self.RadioGroup1_StringVar)

        lbframe = Frame(dialogframe)
        self.Text_1_frame = lbframe
        scrollbar = Scrollbar(lbframe, orient=VERTICAL)
        self.Text_1 = Text(lbframe,
                           width="40",
                           height="6",
                           yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.Text_1.yview)
        scrollbar.pack(side=RIGHT, fill=Y)
        self.Text_1.pack(side=LEFT, fill=BOTH, expand=1)

        self.Text_1_frame.place(x=72, y=250, width=665, height=160)
        # >>>>>>insert any user code below this comment for section "top_of_init"

        self.dirname = '<Select Directory>'
        self.Funcname_Entry.config(state=DISABLED)

        h = Hatch(projName='MyProject', mainDefinesClass='N')
        if h.author:
            self.Author_Entry_StringVar.set(h.author)
        if h.proj_license:
            self.License_Entry_StringVar.set(h.proj_license)
        if h.proj_copyright:
            self.Copyright_Entry_StringVar.set(h.proj_copyright)
        if h.email:
            self.Email_Entry_StringVar.set(h.email)
        if h.github_user_name:
            self.GithubUserName_Entry_StringVar.set(h.github_user_name)
        del h
Ejemplo n.º 22
0
    def __init__(self, master):
        frame = Frame(master)
        frame.pack(fill=BOTH, expand=True)

        url_lab = Label(frame,
                        text='URL:',
                        fg='green',
                        font=('Courier New', 16))
        url_lab.grid(row=0, column=0, sticky=N + E)

        self.url_text = Text(frame,
                             width=60,
                             height=3,
                             font=('Courier New', 12))
        self.url_text.grid(row=0, column=1)

        f5_lab = Label(frame,
                       text='F5 Big-Ip:',
                       fg='blue',
                       font=('Courier New', 14))
        f5_lab.grid(row=1, column=0, sticky=N)

        self.f5bigip = StringVar()
        self.f5bigipEntry = Entry(frame, textvariable=self.f5bigip)
        self.f5bigipEntry.config(font=('Courier New', 12))
        self.f5bigipEntry.config(width=60)
        self.f5bigipEntry.grid(row=1, column=1)

        self.testbtn = Button(frame, text='检测', font=('Courier New', 12))
        self.testbtn.config(width=25)
        self.testbtn.config(bg='LightSkyBlue')
        self.testbtn.grid(row=2, column=1, sticky=W)

        self.decodebtn = Button(frame,
                                text='解码F5 Big-Ip 值',
                                font=('Courier New', 12))
        self.decodebtn.config(width=25)
        self.decodebtn.config(bg='LightSkyBlue')
        self.decodebtn.grid(row=2, column=1, sticky=E)

        self.result_lab = Label(frame,
                                text='执行结果:',
                                fg='blue',
                                font=('Courier New', 14))
        self.result_lab.grid(row=3, column=0, sticky=N + E)

        scroll = Scrollbar(frame)
        scroll.grid(row=3, column=1, sticky=E + N + S)
        self.response = Text(frame,
                             width=58,
                             height=18,
                             font=('Courier New', 12))
        self.response.grid(row=3, column=1, sticky=W + S)
        self.response.config(yscrollcommand=scroll.set)
        scroll.config(command=self.response.yview)

        self.msg = StringVar()
        self.msg_lab = Label(frame,
                             textvariable=self.msg,
                             fg='blue',
                             font=('Courier New', 12))
        self.msg_lab.grid(row=4, column=0, columnspan=2, sticky=N + S + W + E)

        self.testbtn.bind('<Button-1>', self.check)
        self.decodebtn.bind('<Button-1>', self.decode_bigip2)

        self.url = ''
        self.pattern = re.compile('^(?:http|https)://(?:\w+\.)+.+')

        self.headers = {
            "User-Agent":
            "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
        }
Ejemplo n.º 23
0
# form.hidden_input["hidden_var1"] = "value1"
# form.hidden_input["hidden_var2"] = "value2"

Label(form,
      height=1,
      font=('arial', 12, 'bold'),
      text="Question:",
      bg="#99ccff",
      fg='blue4',
      bd=20,
      anchor='w').grid(row=1, column=0, sticky=E, pady=(0, 0))

#function to show and print question
entry = Entry(form,
              font=('arial', 10, 'bold'),
              width=120,
              bd=13,
              bg="#99ccff",
              fg="#012b74")
entry.fieldname = "Question"
entry.grid(row=1, column=1, sticky=E + W)
entry.delete(0, END)
str3 = generateQuestion()
entry.insert(0, (str3))

Label(form,
      font=('arial', 12, 'bold'),
      text="Answer write here:",
      bg="#99ccff",
      fg="#012b74",
      bd=10,
      anchor='w').grid(row=5, column=0, sticky=E, pady=(8, 2))
Ejemplo n.º 24
0
    def createWidgets(self):

        ### Main Menu
        self.mainmenu = Menu(self.master)
        self.mainmenu.config(borderwidth=1)
        self.master.config(menu=self.mainmenu)

        self.filemenu = Menu(self.mainmenu)
        self.filemenu.config(tearoff=0)
        self.mainmenu.add_cascade(label='File',
                                  menu=self.filemenu,
                                  underline=0)
        self.filemenu.add_command(label='New', command=self.wNewCB)
        self.filemenu.add_command(label='Apply', command=self.wApplyCB)
        self.filemenu.add_command(label='Cancel', command=self.wCancelCB)

        self.master.grid_rowconfigure(0, weight=1)
        self.master.grid_columnconfigure(0, weight=1)

        # ++++ Temperature settings ++++
        w = wFrame = LabelFrame(self.master, text='Sample details')

        w.grid(row=0, column=0, sticky=NSEW, padx=5, pady=5)
        w.grid_columnconfigure(0, weight=0)
        w.grid_columnconfigure(1, weight=1)

        # ++++ Sample name ++++
        row = 0
        col = 0
        w = Label(wFrame, text='Name:', anchor=W)
        w.grid(row=row, column=col, sticky=NSEW)

        row += 1
        col = 0
        self.sampleName = StringVar()
        w = self.wName = Entry(wFrame,
                               bg='white',
                               width=10,
                               borderwidth=2,
                               justify=LEFT,
                               textvariable=self.sampleName)
        w.grid(row=row, column=col, sticky=NSEW)

        # ++++ Sample ID ++++
        row += 1
        col = 0
        w = Label(wFrame, text='ID:', anchor=W)
        w.grid(row=row, column=col, sticky=NSEW)

        row += 1
        col = 0
        self.sampleID = StringVar()
        w = self.wIdent = Entry(wFrame,
                                bg='white',
                                width=10,
                                borderwidth=2,
                                justify=LEFT,
                                textvariable=self.sampleID)
        w.grid(row=row, column=col, sticky=NSEW)

        # ++++ Sample description ++++
        row += 1
        col = 0
        w = Label(wFrame, text='Description:', anchor=W)
        w.grid(row=row, column=col, sticky=NSEW)

        row += 1
        col = 0
        w = self.wDescription = Text(wFrame)
        w.grid(row=row, column=col, sticky=NSEW)
Ejemplo n.º 25
0
        rno += 1
    else:
        print "DONE!"


def xit():
    root.destroy()
    exit(0)


root = Tk()
root.geometry("320x240")
root.title("RESULTS GENERATOR V2  -- KAILASH RAMESH")

dl = Label(root, text="Enter DOB: ")
de = Entry(root)
ll = Label(root, text="Enter the Lower Limit: ")
le = Entry(root)
ul = Label(root, text="Enter the Upper Limit: ")
ue = Entry(root)
sub = Button(root, text="GENERATE!", command=operation)
xyt = Button(root, text="EXIT", command=xit)
mod = Button(root, text="Adjust Delays", command=dly)

dl.place(x=20, y=40)
de.place(x=160, y=40)
ll.place(x=20, y=80)
le.place(x=160, y=80)
ul.place(x=20, y=120)
ue.place(x=160, y=120)
sub.place(x=80, y=170)
Ejemplo n.º 26
0
    def __init__(self, master):
        self.master = master
        master.title("Robostats Data Collector")

        global Labels
        self.grassLabels = Labels
        #class vars
        self.isRecording = False
        self.directory_name = StringVar()
        self.grassLabel = StringVar()
        self.grassLabel.set(self.grassLabels[0])
        self.lastcaptime = 0
        self.count = [IntVar() for i in range(len(self.grassLabels))]
        #self.countText = [StringVar(), StringVar(), StringVar()]
        self.countText = [StringVar() for i in range(len(self.grassLabels))]
        for i in range(len(self.grassLabels)):
            self.countText[i].set(self.grassLabels[i] + ":" +
                                  str(self.count[i].get()))

        self.capRate = 10

        global CameraNum
        self.cap = cv2.VideoCapture(CameraNum)

        self.controlFrame = Frame(self.master)
        self.directory_label = Label(self.controlFrame, text="Save Directory:")
        self.dir_box = Entry(self.controlFrame,
                             width=50,
                             textvariable=self.directory_name)
        self.directoryButton = Button(self.controlFrame,
                                      text="Browse",
                                      command=self.set_directory)

        self.rateFrame = Frame(self.master)
        self.rateLabel = Label(self.rateFrame, text="Captures per second: ")
        self.rateSlider = Scale(self.rateFrame,
                                from_=.1,
                                to=30,
                                orient=HORIZONTAL,
                                resolution=0.1,
                                sliderlength=15,
                                length=300,
                                command=self.set_rate)

        self.buttonFrame = Frame(self.master)
        self.startButton = Button(self.buttonFrame,
                                  text="Start",
                                  command=self.start_record,
                                  height=5,
                                  width=12,
                                  bg="#47BD5C")
        self.stopButton = Button(self.buttonFrame,
                                 text="Stop",
                                 command=self.stop_record,
                                 height=5,
                                 width=12,
                                 bg="red")

        self.labelButtonFrame = Frame(self.master)
        self.typeButton = [
            Button(self.labelButtonFrame,
                   text=self.grassLabels[i],
                   height=3,
                   command=lambda num=i: self.set_label(num),
                   width=int(50 / len(self.grassLabels)))
            for i in range(len(self.grassLabels))
        ]
        self.typeButton[0].config(relief=SUNKEN, bg="#F7C45D")

        # self.typeButton = [
        # Button(self.labelButtonFrame, text=self.grassLabels[0], command=lambda:self.set_label(0), height=3, width=10, relief=SUNKEN, bg="#F7C45D"),
        # Button(self.labelButtonFrame, text=self.grassLabels[1], command=lambda:self.set_label(1), height=3, width=10),
        # Button(self.labelButtonFrame, text=self.grassLabels[2], command=lambda:self.set_label(2), height=3, width=10)
        # ]

        self.infoFrame = Frame(self.master)
        self.countLabel = [
            Label(self.infoFrame, textvariable=self.countText[i])
            for i in range(len(self.grassLabels))
        ]
        # self.countLabel = [
        # Label(self.infoFrame, textvariable=self.countText[0]),
        # Label(self.infoFrame, textvariable=self.countText[1]),
        # Label(self.infoFrame, textvariable=self.countText[2])
        # ]

        #layout
        #self.imageFrame.grid(row=0, column=0)
        #self.lmain.grid(row=0, column=0)
        curFrameRow = 0

        self.controlFrame.grid(row=curFrameRow, column=0)
        self.directory_label.grid(row=1, column=0)
        self.dir_box.grid(row=1, column=1)
        self.directoryButton.grid(row=1, column=2)

        curFrameRow += 1

        self.rateFrame.grid(row=curFrameRow, column=0)
        self.rateLabel.grid(row=0, column=0)
        self.rateSlider.grid(row=0, column=1)

        curFrameRow += 1

        self.buttonFrame.grid(row=curFrameRow, column=0, pady=10)
        self.startButton.grid(row=0, padx=5)
        self.stopButton.grid(row=0, column=1, padx=5)

        curFrameRow += 1

        self.labelButtonFrame.grid(row=curFrameRow, column=0)
        col = 0
        for button in self.typeButton:
            button.grid(row=0, column=col, padx=10)
            col += 1

        curFrameRow += 1

        self.infoFrame.grid(row=curFrameRow, column=0, pady=10)
        col = 0
        for label in self.countLabel:
            label.grid(row=0, column=col)
            col += 1
from Tkinter import Tk, Label, Entry, Button, StringVar

my_app = Tk(className='Kalkulator Sederhana')

L1 = Label(my_app, text='Angka 1')
L1.grid(row=0, column=0)
str1 = StringVar()
E1 = Entry(my_app, textvariable=str1)
E1.grid(row=0, column=1, columnspan=3)
L2 = Label(my_app, text='Angka 2')
str2 = StringVar()
L2.grid(row=1, column=0)
E2 = Entry(my_app, textvariable=str2)
E2.grid(row=1, column=1, columnspan=3)


def tambah():
    p = float(str1.get())
    q = float(str2.get())
    r = p + q
    L.config(text=r)


def kurang():
    p = float(str1.get())
    q = float(str2.get())
    r = p - q
    L.config(text=r)


def kali():
Ejemplo n.º 28
0
    def __init__(self,
                 master,
                 entry_width=30,
                 entry_font=None,
                 entry_background="white",
                 entry_highlightthickness=1,
                 button_text="Search",
                 button_ipadx=10,
                 button_background="#009688",
                 button_foreground="white",
                 button_font=None,
                 opacity=0.8,
                 placeholder=None,
                 placeholder_font=None,
                 placeholder_color="grey",
                 spacing=3,
                 command=None):
        Frame.__init__(self, master)

        self._command = command

        self.entry = Entry(self,
                           width=entry_width,
                           background=entry_background,
                           highlightcolor=button_background,
                           highlightthickness=entry_highlightthickness)
        self.entry.pack(side=LEFT,
                        fill=BOTH,
                        expand=True,
                        ipady=1,
                        padx=(0, spacing))

        if entry_font:
            self.entry.configure(font=entry_font)

        if placeholder:
            add_placeholder_to(self.entry,
                               placeholder,
                               color=placeholder_color,
                               font=placeholder_font)

        self.entry.bind("<Escape>",
                        lambda event: self.entry.nametowidget(".").focus())
        self.entry.bind("<Return>", self._on_execute_command)

        opacity = float(opacity)

        if button_background.startswith("#"):
            r, g, b = hex2rgb(button_background)
        else:
            # Color name
            r, g, b = master.winfo_rgb(button_background)

        r = int(opacity * r)
        g = int(opacity * g)
        b = int(opacity * b)

        if r <= 255 and g <= 255 and b <= 255:
            self._button_activebackground = '#%02x%02x%02x' % (r, g, b)
        else:
            self._button_activebackground = '#%04x%04x%04x' % (r, g, b)

        self._button_background = button_background

        self.button_label = Label(self,
                                  text=button_text,
                                  background=button_background,
                                  foreground=button_foreground,
                                  font=button_font)
        if entry_font:
            self.button_label.configure(font=button_font)

        self.button_label.pack(side=LEFT, fill=Y, ipadx=button_ipadx)

        self.button_label.bind("<Enter>", self._state_active)
        self.button_label.bind("<Leave>", self._state_normal)

        self.button_label.bind("<ButtonRelease-1>", self._on_execute_command)
Ejemplo n.º 29
0
    def __init__(self, master, label=""):

        self.label = Label(master, text=label)
        self.entry = Entry(master)
        self.button = Button(master, text="Open", command=self.getLoadName)
        self.options = {}
Ejemplo n.º 30
0
                                  post_count - processed)
                processed += 1

    driver.close()


top = Tk()
top.title('Instagram Downloader')
top.update_idletasks()

# Username or url label and entry box
L_username = Label(top, text="Username or url")
L_username.grid(row=0, column=0, sticky=N + S + E + W)

E_username_text = StringVar()
E_username = Entry(top, bd=2, textvariable=E_username_text)
E_username.grid(row=0, column=1, columnspan=2, sticky=N + S + E + W)

# Download path label, file browser button, and download path entry box
L_path = Label(top, text="Download path")
L_path.grid(row=1, column=0, sticky=N + S + E + W)

B_path_select = Button(top, text="...", command=select_directory_callback)
B_path_select.grid(row=1, column=1, sticky=N + S + E + W)

E_path_text = StringVar()
E_path_text.set(os.getcwd() + '/')
E_path = Entry(top, bd=2, textvariable=E_path_text)
E_path.grid(row=1, column=2)

# Start button