Exemplo n.º 1
2
    def initUI(self):
        #setup title
        self.master.title("Component Creator")
        self.style = Style()
        self.style.theme_use("clam")

        #indicator label
        self.labelName = Label(self, text="Component Name:")
        self.labelName.place(x=10, y=10)
        self.master.update()

        # create variable and namefield for input of component name
        sv = StringVar()
        sv.trace("w", lambda name, index, mode, sv=sv: self.nameChanged(sv))
        self.nameField = Entry(self, textvariable=sv)
        self.nameField.place(x=10+self.labelName.winfo_width() + 10, y=10)
        self.master.update()

        # label for image name that will show img name for a given component name
        self.imgNameVar = StringVar()
        self.imgNameVar.set('imageName:')
        self.labelImageName = Label(self, textvariable=self.imgNameVar)
        self.labelImageName.place(x=10+self.labelName.winfo_width()+10,y=40)

        # checkbox for visible component or not
        self.cbVar = IntVar()
        self.cb = Checkbutton(self, text="Visible Component",  variable=self.cbVar)
        self.cb.place(x=10, y=70)

        # dropdown list for category
        self.labelCategory = Label(self, text="Category:")
        self.labelCategory.place(x=10, y=110)
        self.master.update()

        acts = ['UserInterface', 'Layout', 'Media', 'Animation', 'Sensors', 'Social', 'Storage',
                'Connectivity', 'LegoMindStorms', 'Experimental', 'Internal', 'Uninitialized']

        self.catBox = Combobox(self, values=acts)
        self.catBox.place(x=10+self.labelCategory.winfo_width()+10, y=110)

        # button to select icon image
        self.getImageButton = Button(self, text="Select icon", command=self.getImage)
        self.getImageButton.place(x=10, y=150)
        self.master.update()

        # explanation for resizing
        self.resizeVar = IntVar()
        self.resizeCB = Checkbutton(self,
            text="ON=Resize Image (Requires PIL)\nOFF=Provide 16x16 Image", variable=self.resizeVar)
        self.resizeCB.place(x=10+self.getImageButton.winfo_width()+10, y=150)

        # create button
        self.createButton = Button(self, text="Create", command=self.create)
        self.createButton.place(x=10, y=230)

        #cancel button
        self.cancelButton = Button(self, text="Cancel", command=self.quit)
        self.cancelButton.place(x=200, y=230)
Exemplo n.º 2
1
class ComboBox(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()
        self.speed = 1.0

    def initUI(self):
        self.parent.title("Combobox")
        self.pack(fill = BOTH, expand=True)
        frame = Frame(self)
        frame.pack(fill=X)
        
        field = Label(frame, text = "Typing Speed:", width = 15)
        field.pack(side = LEFT, padx = 5, pady = 5)
        
        self.box_value = StringVar()
        self.box = Combobox(frame, textvariable=self.box_value, width = 5)
        self.box['values'] = ('1x', '2x', '5x', '10x' )
        self.box.current(0)
        self.box.pack(fill = X, padx =5, expand = True)
        self.box.bind("<<ComboboxSelected>>", self.value)
        

    def value(self,event):
        self.speed =  float(self.box.get()[:-1])
Exemplo n.º 3
0
    def initUI(self):
        self.title('Preferences')
        self.rowconfigure(0, pad=6)
        self.rowconfigure(1, pad=1)
        self.rowconfigure(2, pad=6)
        self.columnconfigure(0, pad=1)
        self.columnconfigure(1, pad=1)
        self.columnconfigure(2, pad=1)

        label1 = Label(self, text='Graph Font')
        self.combobox_fonts = Combobox(self, values=self.font_names, width=16)
        self.combobox_fonts.current(
            self.font_names.index(self.parent.font_name))
        label1.grid(row=0, column=0, sticky=W)
        self.combobox_fonts.grid(row=0, column=1, columnspan=2, sticky=W)

        label2 = Label(self, text='Line Color')
        self.combobox_color = Combobox(self,
                                       values=self.parent.line_colors,
                                       width=8)
        self.combobox_color.current(
            self.parent.line_colors.index(self.parent.line_color))
        label2.grid(row=1, column=0, sticky=W)
        self.combobox_color.grid(row=1, column=1, columnspan=2, sticky=W)

        buttonOK = Button(self, text='OK', command=self.on_OK, width=16)
        buttonApply = Button(self,
                             text='Apply',
                             command=self.on_Apply,
                             width=16)
        buttonQuit = Button(self, text='Quit', command=self.on_Quit, width=16)
        buttonOK.grid(row=2, column=0, sticky=W + E + S)
        buttonApply.grid(row=2, column=1, sticky=W + E + S)
        buttonQuit.grid(row=2, column=2, sticky=W + E + S)
Exemplo n.º 4
0
    def init_ui(self):
        self.parent.title("Activity Logger")
        self.parent.focusmodel("active")

        self.style = Style()
        self.style.theme_use("aqua")

        self.combo_text = StringVar()
        cb = self.register(self.combo_complete)
        self.combo = Combobox(self,
                              textvariable=self.combo_text,
                              validate="all",
                              validatecommand=(cb, '%P'))

        self.combo['values'] = ["Food", "Email", "Web"]
        self.combo.pack(side=TOP, padx=5, pady=5, fill=X, expand=0)

        #self.entry = Text(self, bg="white", height="5")
        #self.entry.pack(side=TOP, padx=5, pady=5, fill=BOTH, expand=1)

        self.pack(fill=BOTH, expand=1)
        self.centre()

        self.ok = Button(self, text="Ok", command=self.do_ok)
        self.ok.pack(side=RIGHT, padx=5, pady=5)

        self.journal = Button(self, text="Journal", command=self.do_journal)
        self.journal.pack(side=RIGHT, padx=5, pady=5)

        self.exit = Button(self, text="Exit", command=self.do_exit)
        self.exit.pack(side=RIGHT, padx=5, pady=5)
Exemplo n.º 5
0
    def __init__(self, master, customers, payments, refresh):
        Toplevel.__init__(self,master)

        self.root = master
        self.refresh = refresh

        self.title("Check In")
        self.iconname = "Check In"

        self.name = StringVar() # variable for customer
        self.customers = customers # customers object
        self.payments = payments
        self.names = []
        self.workout = StringVar()
        self.workouts = []
        self.workouts_form = []
        self.date = StringVar()
        self.date.set(strftime("%m/%d/%Y"))
        self.refresh_time = 15 # in minutes
        self.output = '' # for the output label at the bottom
        self.schedule = Schedule()

        self.logger = Logger() #throws IOError if file is open

        inf = Frame(self)
        inf.pack(padx=10,pady=10,side='top')
        Label(inf, text="Name:").grid(row=0,column=0,sticky=E,ipady=2,pady=2,padx=10)
        Label(inf, text='Date:').grid(row=1,column=0,sticky=E,ipady=2,pady=2,padx=10)
        Label(inf, text="Workout:").grid(row=2,column=0,sticky=E,ipady=2,pady=2,padx=10)

        self.name_cb = Combobox(inf, textvariable=self.name, width=30,
                                values=self.names)
        self.name_cb.grid(row=0,column=1,sticky=W,columnspan=2)
        self.date_ent = Entry(inf, textvariable=self.date)
        self.date_ent.grid(row=1,column=1,sticky=W)
        self.date_ent.bind('<FocusOut>', self.update_workouts)
        Button(inf,text='Edit', command=self.enable_date_ent).grid(row=1,column=2,sticky=E)
        self.workout_cb = Combobox(inf, textvariable=self.workout, width=30,
                                   values=self.workouts_form,state='readonly')
        self.workout_cb.grid(row=2,column=1,sticky=W,columnspan=2)

        self.log_btn=Button(inf,text="Log Workout",command=self.log,width=12)
        self.log_btn.grid(row=3,column=1,columnspan=2,pady=4,sticky='ew')
        
        stf = Frame(self)
        stf.pack(padx=10,pady=10,fill='x',side='top')
        self.scrolled_text = ScrolledText(stf,height=15,width=50,wrap='word',state='disabled')
        self.scrolled_text.pack(expand=True,fill='both')

        self.update_workouts()
        self.update_names()

        self.bind('<Return>',self.log)
        self.name_cb.focus_set()  # set the focus here when created

        #disable the date field
        self.disable_date_ent()

        #start time caller
        self.time_caller()
Exemplo n.º 6
0
    def __init__(self, master):

#-----------------------Interface gráfica----------------------------------------------------
        self.frame1 = Frame(master, bg = COR_FUNDO)
        self.frame1.place(relheight = 1.0, relwidth = 1.0)

        self.botao_refresh = Button(self.frame1, text = 'Atualizar dispositivos', font = ('Courier','10'),
                                     fg = 'black', bg = COR_BOTAO_2, borderwidth = 3,
                                     command = self.devices)
        self.botao_refresh.place(relx = 0.202, rely = 0.02, relwidth = 0.54)
        
        Label(self.frame1, text = 'Escolha o dispositivo(CUIDADO)',
              font=('Courier','14'), fg = 'red', bg = COR_FUNDO).place(relx = 0.02, rely = 0.12)
        self.device = Combobox(self.frame1, font = ('Ariel','15'))
        self.device.place(relx = 0.04, rely = 0.20, relwidth = 0.90)

        Label(self.frame1, text='Escolha o Sistema de arquivos',
              font=('Courier','14'), fg = 'white', bg = COR_FUNDO).place(relx = 0.02, rely = 0.32)
        self.sis = Combobox(self.frame1, font = ('Ariel','15'))
        self.sis.place(relx = 0.04, rely = 0.40, relwidth = 0.90)

        self.botao_formatar = Button(self.frame1, text = 'Formatar', font = ('Courier','25'),
                                     fg = 'black', bg = COR_BOTAO_1, borderwidth = 3,
                                     command = self.formatar)
        self.botao_formatar.bind("<Button-1>", self.mudabotao)
        self.botao_formatar.place(relx = 0.21, rely = 0.82, relwidth = 0.54)

        self.devices()
        self.sis_file()
Exemplo n.º 7
0
class SnapFrame(Frame):

    def __init__(self, parent, cb=dummy):
        Frame.__init__(self, parent)
        self.parent = parent
        self.cb = cb

        self._init_ui()

    def _cb(self, *args):
        self.cb(SNAP_DICT[self._var.get()])

    def _init_ui(self):
        self._var = StringVar()

        self.snap_combobox = Combobox(
            self, values=SNAP_DICT.keys(),
            width=5, textvariable=self._var,
            state='readonly')
        self.snap_combobox.set(SNAP_DICT.keys()[0])
        self._var.trace('w', self._cb)

        self.snap_label = Label(self, text='Snap')

        self.snap_label.pack(side=LEFT)
        self.snap_combobox.pack(side=LEFT)
Exemplo n.º 8
0
    def gui(self):
        self.root = Tk()
        self.root.title('video converter')
        self.entry_link = Entry(self.root, width=self.ENTRY_WITDH, state='disabled')
        self.entry_link.grid(row=0, column=0, columnspan=2)
        self.link_contend = StringVar()
        self.entry_link.config(textvariable=self.link_contend)
        self.link_contend.set('plz choose:')
        self.choose_button = Button(self.root, text='choose', width=self.button_width, command=self.chooseFile)
        self.choose_button.grid(row=1, column=0, columnspan=1)
        self.clear_button = Button(self.root, text='empty', width=self.button_width, command=self.emptyIt)
        self.clear_button.grid(row=1, column=1, columnspan=1)
        self.outType = StringVar()
        self.typeChosen = Combobox(self.root, width=self.ENTRY_WITDH, textvariable=self.outType)
        self.typeChosen['values'] = ('wav', 'mp4', 'flv', 'mp3', 'gif')
        self.typeChosen.current(3)
        self.typeChosen.grid(row=2, column=0, columnspan=2)

        self.startButton = Button(self.root, text='Start Convert', width=self.button_width * 2,
                                  command=self.startFFmpeg)
        self.startButton.grid(row=3, column=0, columnspan=2)

        self.result_link = Entry(self.root, width=self.ENTRY_WITDH, state='disabled')
        self.result_link.grid(row=4, column=0, columnspan=2)
        self.result_link_contend = StringVar()
        self.result_link.config(textvariable=self.result_link_contend)
        self.result_link_contend.set('plz hold on:')

        mainloop()
 def __initializeComponents(self):
     self.imageCanvas = Canvas(master=self, width=imageCanvasWidth,
                               height=windowElementsHeight, bg="white")
     self.imageCanvas.pack(side=LEFT, padx=(windowPadding, 0),
                           pady=windowPadding, fill=BOTH)
     
     self.buttonsFrame = Frame(master=self, width=buttonsFrameWidth,
                               height=windowElementsHeight)
     self.buttonsFrame.propagate(0)
     self.loadFileButton = Button(master=self.buttonsFrame,
                                  text=loadFileButtonText, command=self.loadFileButtonClick)
     self.loadFileButton.pack(fill=X, pady=buttonsPadding);
     
     self.colorByLabel = Label(self.buttonsFrame, text=colorByLabelText)
     self.colorByLabel.pack(fill=X)
     self.colorByCombobox = Combobox(self.buttonsFrame, state=DISABLED,
                                     values=colorByComboboxValues)
     self.colorByCombobox.set(colorByComboboxValues[0])
     self.colorByCombobox.bind("<<ComboboxSelected>>", self.__colorByComboboxChange)
     self.colorByCombobox.pack(fill=X, pady=buttonsPadding)
     self.rejectedValuesPercentLabel = Label(self.buttonsFrame, text=rejectedMarginLabelText)
     self.rejectedValuesPercentLabel.pack(fill=X)
     self.rejectedValuesPercentEntry = Entry(self.buttonsFrame)
     self.rejectedValuesPercentEntry.insert(0, defaultRejectedValuesPercent)
     self.rejectedValuesPercentEntry.config(state=DISABLED)
     self.rejectedValuesPercentEntry.pack(fill=X, pady=buttonsPadding)        
     
     self.colorsSettingsPanel = Labelframe(self.buttonsFrame, text=visualisationSettingsPanelText)
     self.colorsTableLengthLabel = Label(self.colorsSettingsPanel, text=colorsTableLengthLabelText)
     self.colorsTableLengthLabel.pack(fill=X)
     self.colorsTableLengthEntry = Entry(self.colorsSettingsPanel)
     self.colorsTableLengthEntry.insert(0, defaultColorsTableLength)
     self.colorsTableLengthEntry.config(state=DISABLED)
     self.colorsTableLengthEntry.pack(fill=X)
     self.scaleTypeLabel = Label(self.colorsSettingsPanel, text=scaleTypeLabelText)
     self.scaleTypeLabel.pack(fill=X)
     self.scaleTypeCombobox = Combobox(self.colorsSettingsPanel, state=DISABLED,
                                       values=scaleTypesComboboxValues)
     self.scaleTypeCombobox.set(scaleTypesComboboxValues[0])
     self.scaleTypeCombobox.bind("<<ComboboxSelected>>", self.__scaleTypeComboboxChange)
     self.scaleTypeCombobox.pack(fill=X)
     self.colorsTableMinLabel = Label(self.colorsSettingsPanel, text=colorsTableMinLabelText)
     self.colorsTableMinLabel.pack(fill=X)
     self.colorsTableMinEntry = Entry(self.colorsSettingsPanel)
     self.colorsTableMinEntry.insert(0, defaultColorsTableMin)
     self.colorsTableMinEntry.config(state=DISABLED)
     self.colorsTableMinEntry.pack(fill=X)
     self.colorsTableMaxLabel = Label(self.colorsSettingsPanel, text=colorsTableMaxLabelText)
     self.colorsTableMaxLabel.pack(fill=X)
     self.colorsTableMaxEntry = Entry(self.colorsSettingsPanel)
     self.colorsTableMaxEntry.insert(0, defaultColorsTableMax)
     self.colorsTableMaxEntry.config(state=DISABLED)
     self.colorsTableMaxEntry.pack(fill=X)
     self.colorsSettingsPanel.pack(fill=X, pady=buttonsPadding)
     
     self.redrawButton = Button(master=self.buttonsFrame, text=redrawButtonText,
                                state=DISABLED, command=self.__redrawButtonClick)
     self.redrawButton.pack(fill=X, pady=buttonsPadding)
     self.buttonsFrame.pack(side=RIGHT, padx=windowPadding, pady=windowPadding, fill=BOTH)
Exemplo n.º 10
0
    def initUI(self):
        
        self.lbox = Listbox(self, height = 10, width = 55)
        sbar = Scrollbar(self, command=self.lbox.yview)
        sbar.place(x=360, y=240)
        self.lbox.config(yscrollcommand=sbar.set)
        self.lbox.place(x=10, y=240)

        self.lbox.insert('end',  "Interface Básica de Controle dos Motores - v1.0")
        self.lbox.insert('end', "S.O. (%s)"  % (sys.platform))
      
        self.parent.title("Interface básica para controle dos motores - v1.0")
        self.pack(fill=BOTH, expand=1)

        self.opts = ""
        self.cbox = Combobox(self, textvariable=self.opts, state='readonly')
        for n,s in scan():
            self.opts += "%s " % (s)
              
        self.cbox['values'] = self.opts
        if(self.opts != ""):
            self.cbox.current(0)
        self.cbox.place(x=10, y=10)
        "self.cbox.bind('<<ComboboxSelected>>', self.conectar)"

        btConectar = Button(self, text="Conectar", width=10)
        btConectar.bind("<Button-1>", self.conectar)
        btConectar.place(x=200, y=10)
        
        btFrente = Button(self, text="/\\", width=5)
        btFrente.bind("<Button-1>", self.comandoF)
        btFrente.place(x=160, y=100)
        btTraz = Button(self, text="\/", width=5)
        btTraz.bind("<Button-1>", self.comandoT)
        btTraz.place(x=160, y=130)

        btEsqFrente = Button(self, text="/\\", width=5)
        btEsqFrente.place(x=50, y=70)
        btEsqFrente.bind("<Button-1>", self.comandoEF)
        btEsqTraz = Button(self, text="\/", width=5)
        btEsqTraz.place(x=50, y=150)
        btEsqTraz.bind("<Button-1>", self.comandoET)

        btDirFrente = Button(self, text="/\\", width=5)
        btDirFrente.place(x=260, y=70)
        btDirFrente.bind("<Button-1>", self.comandoDF)
        btDirTraz = Button(self, text="\/", width=5)
        btDirTraz.place(x=260, y=150)
        btDirTraz.bind("<Button-1>", self.comandoDT)

        btGiraEsq = Button(self, text=">>", width=5)
        btGiraEsq.place(x=90, y=200)
        btGiraEsq.bind("<Button-1>", self.comandoGE)
        btParar = Button(self, text="-x-", width=5)
        btParar.place(x=160, y=200)
        btParar.bind("<Button-1>", self.comandoP)
        btGiraDir = Button(self, text="<<", width=5)
        btGiraDir.place(x=230, y=200)
        btGiraDir.bind("<Button-1>", self.comandoGD)  
Exemplo n.º 11
0
 def get_map_list(self):
     self.available_maps = sorted(
         m for m in get_available_maps(config=self.config))
     self.map_list = Combobox(self.button_frame,
                              height=24,
                              width=24,
                              values=self.available_maps)
     if len(self.available_maps):
         self.map_list.set(self.available_maps[0])
Exemplo n.º 12
0
 def __init__(self, parent, **kwargs):
     """!
     A constructor for the class
     @param self The pointer for the object
     @param parent The parent object for the frame
     @param **kwargs Other arguments as accepted by ttk.Combobox
     """
     #Initialise the inherited class
     Combobox.__init__(self, parent, **kwargs)
Exemplo n.º 13
0
def Reset():
    Combobox.set("")
    Tax.set("")
    SubTotal.set("")
    TotalCost.set("")
    CustomerName.set("")
    CustomerPhone.set("")
    CustomerEmail.set("")
    CustomerRef.set("")
Exemplo n.º 14
0
    def __init__(self, master, customers, payments, output_text, refresh):
        Frame.__init__(self, master)

        self.refresh = refresh
        self.master = master
        self.output_text = output_text
        self.customers = customers
        self.payments = payments

        self.pname = StringVar()
        self.pnames = []
        self.mname = StringVar()
        self.mnames = []
        self.date = StringVar()
        self.nmonths = StringVar()
        self.punches = StringVar()

        self.nmonths.set('1')
        self.punches.set(str(10))
        self.date.set(strftime("%m/%d/%Y"))

        self.columnconfigure(0,weight=1)

        # Monthly Customers
        monthly_lf = LabelFrame(self, text="Monthly Customers Payment")
        monthly_lf.grid(padx=5,pady=5,row=0,column=0,sticky='ew')
        
        Label(monthly_lf,text="Name:").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
        Label(monthly_lf,text="Date:").grid(row=0,column=3,sticky='e',padx=(10,0),pady=(10,2))
        Label(monthly_lf,text="# Months:").grid(row=1,column=0,columnspan=2,sticky='e',padx=(10,0),pady=(2,10))
        self.mname_cb = Combobox(monthly_lf,textvariable=self.mname,width=20,values=self.mnames,
            state='readonly')
        self.mname_cb.grid(row=0,column=1,columnspan=2,sticky='ew',pady=(10,2))
        Entry(monthly_lf,textvariable=self.date,width=15).grid(row=0,column=4,sticky='ew',padx=(0,10),pady=(10,2))
        Entry(monthly_lf,textvariable=self.nmonths).grid(row=1,column=2,sticky='ew',pady=(2,10))
        Button(monthly_lf,text='Submit',command=self.monthly_payment).grid(row=1,column=4,sticky='ew',padx=(0,10),pady=(2,10))

        for i in range(5):
            monthly_lf.columnconfigure(i,weight=1)

        # Punch Card Customers
        puch_lf = LabelFrame(self, text="Punch Card Customers (Purchace Card)")
        puch_lf.grid(padx=5,pady=5,row=1,column=0,sticky='ew')

        Label(puch_lf,text="Name:").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
        Label(puch_lf,text="Punches:").grid(row=0,column=2,sticky='e',pady=(10,2))
        self.pname_cb = Combobox(puch_lf,textvariable=self.pname,width=20,values=self.pnames,state='readonly')
        self.pname_cb.grid(row=0,column=1,sticky='ew',pady=(10,2))
        Entry(puch_lf,textvariable=self.punches,width=15).grid(row=0,column=3,sticky='ew',padx=(0,10),pady=(10,2))
        Button(puch_lf,text='Submit',command=self.new_punchcard).grid(row=3,column=3,sticky='ew',padx=(0,10),pady=(2,10))

        for i in range(4):
            puch_lf.columnconfigure(i,weight=1)

        self.update_names()
Exemplo n.º 15
0
class SendGCode(LabelFrame):
	def __init__(self, root, prtr, settings, log, *arg):
		LabelFrame.__init__(self, root, *arg, text="Send gcode")
		self.app = root
		self.printer = prtr
		self.settings = settings
		self.log = log

		self.entry = Entry(self, width=50)
		self.entry.grid(row=1, column=1, columnspan=3, sticky=N+E+W)
		
		self.bSend = Button(self, text="Send", width=4, command=self.doSend, state=DISABLED)
		self.bSend.grid(row=1, column=4, padx=2)
		
		self.entry.delete(0, END)
		
		self.entry.bind('<Return>', self.hitEnter)
		self.gcv = StringVar(self)
		
		gclist = gcoderef.gcKeys()
		self.gcv.set(gclist[0])

		l = Label(self, text="G Code Reference:", justify=LEFT)
		l.grid(row=2, column=1, columnspan=2, sticky=W)

		self.gcm = Combobox(self, textvariable=self.gcv)
		self.gcm['values'] = gclist
		self.gcm.grid(row=2, column=3, padx=2)
		
		self.gcm.bind('<<ComboboxSelected>>', self.gcodeSel)
		
		#self.bInfo = Button(self, text="Info", width=9, command=self.doInfo)
		#self.bInfo.grid(row=2, column=4, padx=2)
		
	#def doInfo(self):
	def gcodeSel(self, *arg):
		verb = self.gcv.get()
		self.log.logMsg("%s: %s" % (verb, gcoderef.gcText(verb)))
		
	def activate(self, flag):
		if flag:
			self.bSend.config(state=NORMAL)
		else:
			self.bSend.config(state=DISABLED)
			
	def hitEnter(self, e):
		self.doSend()
		
	def doSend(self): 
		cmd = self.entry.get()
		verb = cmd.split()[0]
		
		if self.app.printerAvailable(cmd=verb):
			self.log.logMsg("Sending: %s" % cmd)
			self.printer.send_now(cmd)
Exemplo n.º 16
0
    def addActionFrame(self):

        frame = Frame(self, relief=tk.RAISED, borderwidth=1)
        frame.pack(fill=tk.X,side=tk.TOP,\
                expand=0,padx=8,pady=5)

        #label=tk.Label(frame,text='Actions:',bg='#bbb')
        #label.grid(row=0,column=0,sticky=tk.W,padx=8)

        #---------------Action checkbuttons---------------
        frame.columnconfigure(0, weight=1)

        #---------------------2nd row---------------------
        subframe = Frame(frame)
        subframe.grid(row=1,column=0,columnspan=6,sticky=tk.W+tk.E,\
                pady=5)

        #-------------------Album options-------------------
        albumlabel=tk.Label(subframe,text=dgbk('专辑:'),\
                bg='#bbb')
        albumlabel.pack(side=tk.LEFT, padx=8)

        self.album = tk.StringVar()
        self.albumnames = [
            'All',
        ]
        self.albummenu=Combobox(subframe,textvariable=\
                self.album,values=self.albumnames,state='readonly')
        self.albummenu.current(0)
        self.albummenu.bind('<<ComboboxSelected>>', self.setAlbum)
        self.albummenu.pack(side=tk.LEFT, padx=8)

        #-------------------Quit button-------------------
        quit_button=tk.Button(subframe,text=dgbk('退出'),\
                command=self.quit)
        quit_button.pack(side=tk.RIGHT, padx=8)

        #-------------------Stop button-------------------
        '''
        self.stop_button=tk.Button(subframe,text='Stop',\
                command=self.stop)
        self.stop_button.pack(side=tk.RIGHT,padx=8)
        '''

        #-------------------Start button-------------------
        self.start_button=tk.Button(subframe,text=dgbk('开始'),\
                command=self.start,state=tk.DISABLED)
        self.start_button.pack(side=tk.RIGHT, pady=8)

        #-------------------Help button-------------------
        self.help_button=tk.Button(subframe,text=dgbk('帮助'),\
                command=self.showHelp)
        self.help_button.pack(side=tk.RIGHT, padx=8)
    def cluster_dis(self):

        # canvas and listbox

        self.canvas1 = Canvas(self.frame3,
                              bg='#FFFFFF',
                              width=1100,
                              height=300)
        self.canvas1.grid(row=0, column=0)

        self.scollbary = Scrollbar(self.frame3,
                                   orient="vertical",
                                   command=self.canvas1.yview)
        self.scollbary.grid(row=0, column=0, sticky='nsew')

        self.scollbarx = Scrollbar(self.frame3,
                                   orient="horizontal",
                                   command=self.canvas1.xview)
        self.scollbarx.grid(row=0, column=0, sticky='nsew')

        Label(self.frame4, text="Districts :").grid(row=0, column=0)

        self.districts_listbox = Listbox(self.frame4,
                                         selectmode="multiple",
                                         height=13,
                                         width=20)
        self.districts_listbox.grid(row=0, column=1)

        # adding districts to listbox

        for i in self.results.keys():
            self.districts_listbox.insert(END, i)

        self.scollbary_listbox = Scrollbar(
            self.frame4,
            orient="vertical",
            command=self.districts_listbox.yview)
        self.scollbary_listbox.grid(row=0, column=1, sticky='nsew')

        Label(self.frame4, text="Threshold :").grid(row=0, column=2)

        self.combobox = Combobox(
            self.frame4,
            state="readonly",
            values=["%0", "%1", "%10", "%20", "%30", "%40", "%50"])
        self.combobox.grid(row=0, column=3)

        self.refine_button = Button(self.frame4,
                                    text="Refine Analysis",
                                    width=45,
                                    height=2,
                                    command=self.cluster_dis)
        self.refine_button.grid(row=0, column=4)
Exemplo n.º 18
0
    def add_param_fields(self, frame, rownum, object_map):
        #create the fields
        key_option_val  = StringVar(frame)
        key_option_val.set(self.keywords[0])
        key_option_menu = Combobox(frame, textvariable=key_option_val, state='readonly')
        key_option_menu['values'] = self.keywords
        key_option_menu.grid(row=0, column=0, sticky=W, pady=10, padx=10)

        val_text   = StringVar(frame)
        val_entry  = Entry(frame, textvariable=val_text)
        val_entry.grid(row=0, column=1, pady=10, padx=10, sticky=W)
        
        object_map.append((key_option_val, val_text))
Exemplo n.º 19
0
	def __init__(self, parent, question, i, defaultanswer, *options):
		LabelFrame.__init__(self, parent, text=question, padx=5, pady=5)
		self.var = StringVar(parent)
		try:
			if defaultanswer in options:
				options = tuple(x for x in options if x != defaultanswer)
			options = (defaultanswer,) + options		
			self.var.set(options[0])
		except IndexError:
			self.var.set("")
		self.om = Combobox(self, textvariable=self.var)
		self.om['values'] = options
		self.om.pack(padx=5,pady=5, side="left")
		self.grid(row=i,column=0,columnspan=3, sticky=W, pady=10)
Exemplo n.º 20
0
    def __init__(self, root, *args, **kwargs):
        label_kwargs = dict(text=kwargs.pop('label', ''))
        combobox_kwargs = dict()
        combobox_kwargs['state'] = kwargs.pop('state', 'normal')
        combobox_kwargs['textvariable'] = kwargs.pop('textvariable', None)

        Frame.__init__(self, root, *args, **kwargs)

        self.label = Label(self, **label_kwargs)
        self.combobox = Combobox(self, **combobox_kwargs)
        self.values = list()

        self.label.pack(side=LEFT)
        self.combobox.pack(side=RIGHT)
Exemplo n.º 21
0
    def initUI(self):
      
        self.parent.title("TRAM")
        self.style = Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)

        #Model Text
        self.t = Text(self, borderwidth=3, relief="sunken")
        self.t.config(font=("consolas", 12), undo=True, wrap='word')
        self.t.grid(row=0, column=0, padx=2, pady=2, sticky=(N, W, E, S))
        
        
        
        #Search Panel
        searchPanel = LabelFrame(self, text="Find your model")
        searchPanel.grid(row=0, column=1, padx=2, pady=2, sticky=N) 
        
        Label(searchPanel, text="Model name").grid(row=0, column=0, padx=2, pady=2, sticky=W)
        
        searchQueryEntry = Entry(searchPanel, textvariable=self.searchQuery)
        searchQueryEntry.grid(row=0, column=1, padx=2, pady=2, sticky=W)
        
        Label(searchPanel, text="Transformation").grid(row=1, column=0, padx=2, pady=2, sticky=W)
        preferredTransformation = StringVar()
        box = Combobox(searchPanel, textvariable=preferredTransformation, state='readonly')
        box['values'] = ('Any...', 'Object Change', 'Object Extension', 'Specialization', 'Functionality Extension', 'System Extension', 'Soft Simplification', 'Hard Simplification')
        box.current(0)
        box.grid(row=1, column=1, padx=2, pady=2, sticky=W)
        
        findButton = Button(searchPanel, text="Find", command = self.__findModels)
        findButton.grid(row=2, column=1, padx=2, pady=2, sticky=E)
        
        #Listbox with recommendations
        recommendationPanel = LabelFrame(self, text="Recommended models (transformations)")
        recommendationPanel.grid(row=0, column=1, padx=2, pady=2, sticky=(W,E,S))
        self.l = Listbox(recommendationPanel)
        self.l.pack(fill=BOTH, expand=1)
        
        #Button frame
        transformButtonPanel = Frame(recommendationPanel)
        transformButtonPanel.pack(fill=BOTH, expand=1)
        
        viewButton = Button(transformButtonPanel, text="View", command = self.__loadSelectedModel)
        viewButton.grid(row=1, column=0, padx=2, pady=2)
        
        transformButton = Button(transformButtonPanel, text="Transform", command = self.__transformModel)
        transformButton.grid(row=1, column=2, padx=2, pady=2)
Exemplo n.º 22
0
def editor(): 
    """Run editor"""
    global zone_dessin     
    global grid 
    global entry_retour
    global combobox_difficulty
    global lvlList
    
    grid = Grid()
    
    # Windows
    fenetre = Tk()

    fenetre.geometry("500x525")
    fenetre.title("Editeur Hanjie")
    fenetre.resizable(width=False, height=False)

    # Canvas
    zone_dessin = Canvas(fenetre,width=500,height=500, bg="white")
    zone_dessin.place(x=0,y=0) 
    Initialisation()
    zone_dessin.bind("<Button-1>", Swap)

    # Entry
    default_text = StringVar()
    entry_retour = Entry(fenetre,width=20,textvariable=default_text)
    default_text.set("Level name...")
    entry_retour.place(x=2,y=503)

    # Save Button
    button_save = Button(fenetre,text="Save", width=8,height=1, command = But_Save)
    button_save.place(x=130,y=500)

    # Load Button
    button_load = Button(fenetre,text="Load", width=8,height=1, command = But_Load)
    button_load.place(x=200,y=500)

    # Reset Button
    button_load = Button(fenetre,text="Reset", width=8,height=1, command = But_Reset)
    button_load.place(x=270,y=500)

    # Difficulty Combobox
    lvlSelect = StringVar()
    lvlList = ('LVL 1', 'LVL 2', 'LVL 3', 'LVL 4', 'LVL 5')
    combobox_difficulty = Combobox(fenetre, values = lvlList, state = 'readonly')    
    combobox_difficulty.set(lvlList[0])
    combobox_difficulty.place(x=340,y=502)

    fenetre.mainloop()
Exemplo n.º 23
0
    def initUI(self):
        self.parent.title("Combobox")
        self.pack(fill=BOTH, expand=True)
        frame = Frame(self)
        frame.pack(fill=X)

        field = Label(frame, text="Typing Speed:", width=15)
        field.pack(side=LEFT, padx=5, pady=5)

        self.box_value = StringVar()
        self.box = Combobox(frame, textvariable=self.box_value, width=5)
        self.box['values'] = ('1x', '2x', '5x', '10x')
        self.box.current(0)
        self.box.pack(fill=X, padx=5, expand=True)
        self.box.bind("<<ComboboxSelected>>", self.value)
Exemplo n.º 24
0
class JournalEntry(LabelFrame):
	def __init__(self, parent, question, i, defaultanswer, *options):
		LabelFrame.__init__(self, parent, text=question, padx=5, pady=5)
		self.var = StringVar(parent)
		try:
			if defaultanswer in options:
				options = tuple(x for x in options if x != defaultanswer)
			options = (defaultanswer,) + options		
			self.var.set(options[0])
		except IndexError:
			self.var.set("")
		self.om = Combobox(self, textvariable=self.var)
		self.om['values'] = options
		self.om.pack(padx=5,pady=5, side="left")
		self.grid(row=i,column=0,columnspan=3, sticky=W, pady=10)
 def dynamic(self):
     self.canvasframe = Frame(self)  # to keep canvas
     self.canvasframe.pack(fill=X)
     self.canvas = Canvas(self.canvasframe, bg='grey')
     self.vbar = Scrollbar(self.canvasframe,
                           orient=VERTICAL)  # vertical scrollbar
     self.vbar.pack(side=RIGHT, fill=Y)
     self.vbar.config(
         command=self.canvas.yview)  # to adapt vertical scrollbar to canvas
     self.hbar = Scrollbar(self.canvasframe,
                           orient=HORIZONTAL)  # horizontal scrollbar
     self.hbar.pack(side=BOTTOM, fill=X)
     self.hbar.config(command=self.canvas.xview
                      )  # to adapt horizontal scrollbar to canvas
     self.canvas.pack(fill=X)
     self.canvas.config(
         xscrollcommand=self.hbar.set,
         yscrollcommand=self.vbar.set)  # to set scrollbars in canvas
     self.bottomframe = Frame(self)  # Frame to keep listbox and so on
     self.bottomframe.pack(fill=X)
     Label(self.bottomframe,
           text='Districts:').pack(side=LEFT,
                                   padx=(150, 0))  # districts label
     self.scroll = Scrollbar(self.bottomframe,
                             orient="vertical")  # Scrollbar to listbox
     self.listbox = Listbox(self.bottomframe,
                            selectmode='multiple',
                            yscrollcommand=self.scroll.set)
     self.listbox.pack(side=LEFT)
     self.scroll.config(command=self.listbox.yview
                        )  # to adapt vertical scrollbar to canvas
     self.scroll.pack(side=LEFT, fill="y")
     Label(self.bottomframe, text='Treshould:').pack(side=LEFT)
     self.combo = Combobox(
         self.bottomframe,
         values=['0%', '1%', '10%', '20%', '30%', '40%', '50%'],
         width=5)  # create combobox to keep persantages
     self.combo.pack(side=LEFT)
     self.combo.current(0)
     self.analysisbtn = Button(self.bottomframe,
                               text="Refine Analysis",
                               width=30,
                               height=2,
                               command=self.refine_analysis)
     self.analysisbtn.pack(side=LEFT)
     for i in sorted(
             self.appdata.districts):  # to append all districts in listbox
         self.listbox.insert(END, i)
Exemplo n.º 26
0
	def __init__(self, root, prtr, settings, log, *arg):
		LabelFrame.__init__(self, root, *arg, text="Send gcode")
		self.app = root
		self.printer = prtr
		self.settings = settings
		self.log = log

		self.entry = Entry(self, width=50)
		self.entry.grid(row=1, column=1, columnspan=3, sticky=N+E+W)
		
		self.bSend = Button(self, text="Send", width=4, command=self.doSend, state=DISABLED)
		self.bSend.grid(row=1, column=4, padx=2)
		
		self.entry.delete(0, END)
		
		self.entry.bind('<Return>', self.hitEnter)
		self.gcv = StringVar(self)
		
		gclist = gcoderef.gcKeys()
		self.gcv.set(gclist[0])

		l = Label(self, text="G Code Reference:", justify=LEFT)
		l.grid(row=2, column=1, columnspan=2, sticky=W)

		self.gcm = Combobox(self, textvariable=self.gcv)
		self.gcm['values'] = gclist
		self.gcm.grid(row=2, column=3, padx=2)
		
		self.gcm.bind('<<ComboboxSelected>>', self.gcodeSel)
Exemplo n.º 27
0
    def __init__(self, parent, projects, onCreation=None):
        Frame.__init__(self, parent)

        self.onCreation = onCreation

        self.time = StringVar()
        self.time.set("00:00:00")
        self.timeEntry = None

        self.projects = projects.values()
        self.projects.sort(key=lambda x: x.name)

        l = Label(self, text="Description")
        l.grid(row=0, column=0)

        self.description = StringVar()
        e = Entry(self, textvariable=self.description, font=("Helvetica", 16))
        e.grid(row=1, column=0)

        l = Label(self, text="Project")
        l.grid(row=0, column=1)

        values = map(lambda x: x.name, self.projects)
        self.projectChooser = Combobox(self, values=values, font=("Helvetica", 16))
        self.projectChooser.grid(row=1, column=1)

        self.timeEntryClock = Label(self, textvariable=self.time, font=("Helvetica", 16))
        self.timeEntryClock.grid(row=1, column=2)

        self.submitText = StringVar()
        self.submitText.set("Start")
        self.submit = Button(self, textvariable=self.submitText, command=self.start, font=("Helvetica", 16))
        self.submit.grid(row=1, column=3, padx=10)
Exemplo n.º 28
0
 def initializeComponents(self):
     self.boxValue = StringVar()
     self.boxValue.trace('w', \
         lambda name, index, mode, \
         boxValue = self.boxValue : \
         self.box_valueEditted(boxValue))
         
     self.box = Combobox(self,\
         justify = 'left',\
         width = 50, \
         textvariable = self.boxValue,\
     )
     self.box.pack(side = 'left',expand = 1, padx = 5, pady = 5)
     self.box.bind('<<ComboboxSelected>>',self.box_selected)
     self.box.bind('<Return>',self.box_returned)
     
     self.importButton = Button(self, \
         text = "Import", \
         command = self.importButton_clicked,\
     )
     self.importButton.pack(side = 'left',expand = 1)
     
     self.cmd_str = StringVar(None,"Prefix Only")
     self.switchButton = Button(self, \
         textvariable = self.cmd_str, \
         command = self.switchButton_clicked, \
     )
     self.switchButton.pack(side = 'right', padx = 5, pady = 5)
Exemplo n.º 29
0
 def __init__(self, menu):
     Tk.__init__(self)
     
     self.title("Pick a level")
     
     icon = PhotoImage(file=os.getcwd() + '/res/logo/logo.gif')
     self.tk.call("wm", "iconphoto", self._w, icon)
     
     self.eval('tk::PlaceWindow %s center' % self.winfo_pathname(self.winfo_id()))
     
     self.levels = [file[:-4] for file in listdir("res/levels")]
     self.protocol("WM_DELETE_WINDOW", self.shutdownTTK)
     
     if not self.levels:  # No levels
         self.withdraw()
         tkMessageBox.showwarning("Error", 'There doesn\'t seem to be any levels saved. Create one pressing the "Design Level" button!')
         self.shutdownTTK()
         
     else:
         self.menu = menu
         
         self.value = StringVar()
         self.levels_list = Combobox(self, textvariable=self.value, state='readonly')
         
         self.levels_list['values'] = self.levels
         self.levels_list.current(0)
         self.levels_list.grid(column=0, row=0)
         
         self.button = Button(self, text="Begin Level", command=self.begin_level)
         self.button.grid(column=0, row=1)
         self.mainloop()
Exemplo n.º 30
0
    def __init__(self, place_class, string_class, DefaultValue, choise_class = False, button_add = False):
#При создании принимается место прикрепления виджета и строковое значение для надписи.
# A string value to add a combobox or a button could be also inputed.

        def button_finfo():
            messagebox.showinfo(locale(u"ui_iftxt", Settingz["str_langu"]), button_add)
# Here it is a function to show information window.

        self.frame_class = Frame(place_class)
        self.frame_class.pack(side = TOP, fill = BOTH)
#Внутри – рамка для виджетов, растягивается по ширине окна.
        self.label_class = Label(self.frame_class, text = string_class)
        self.label_class.pack(side = LEFT)
#В ней – надписи для описания вводимых значений выровнены по левому краю.
        self.entry_class = Entry(self.frame_class, width = 15)
        self.entry_class.pack(side = RIGHT)
        self.entry_class.insert(0, DefaultValue)
#И элементы для ввода значений шириной в 15 знаков выровнены по правому краю.
        if choise_class:
            self.box_class = Combobox(self.frame_class, values = choise_class, width = 2)
            self.box_class.set(choise_class[0])
            self.box_class.pack(side = RIGHT)
        elif button_add:
            self.button_class = Button(self.frame_class, text = u"?", command = button_finfo, width = -1)
            self.button_class.pack(side = RIGHT)
Exemplo n.º 31
0
Arquivo: alog.py Projeto: da4089/alog
    def init_ui(self):
        self.parent.title("Activity Logger")
        self.parent.focusmodel("active")
        
        self.style = Style()
        self.style.theme_use("aqua")

        self.combo_text = StringVar()
        cb = self.register(self.combo_complete)
        self.combo = Combobox(self,
                              textvariable=self.combo_text,
                              validate="all",
                              validatecommand=(cb, '%P'))

        self.combo['values'] = ["Food", "Email", "Web"]
        self.combo.pack(side=TOP, padx=5, pady=5, fill=X, expand=0)

        #self.entry = Text(self, bg="white", height="5")
        #self.entry.pack(side=TOP, padx=5, pady=5, fill=BOTH, expand=1)
        
        self.pack(fill=BOTH, expand=1)
        self.centre()

        self.ok = Button(self, text="Ok", command=self.do_ok)
        self.ok.pack(side=RIGHT, padx=5, pady=5)

        self.journal = Button(self, text="Journal", command=self.do_journal)
        self.journal.pack(side=RIGHT, padx=5, pady=5)

        self.exit = Button(self, text="Exit", command=self.do_exit)
        self.exit.pack(side=RIGHT, padx=5, pady=5)
Exemplo n.º 32
0
    def add_attr(self):
        """添加一行数据"""
        for i, property_name in enumerate(self.properties.keys()):
            configs = self.properties.get(property_name)
            getattr(self, 'attr_%ss' % property_name).append(StringVar())
            if 'type' not in configs:
                getattr(self, 'entry_%ss' % property_name).append(
                    Entry(self.group,
                          width=configs.get('width'),
                          textvariable=getattr(
                              self,
                              'attr_%ss' % property_name)[self.attr_count]))
            else:
                getattr(self, 'entry_%ss' % property_name).append(
                    Combobox(self.group,
                             width=configs.get('width'),
                             textvariable=getattr(
                                 self,
                                 'attr_%ss' % property_name)[self.attr_count],
                             values=configs.get('type')))
                getattr(self, 'entry_%ss' %
                        property_name)[self.attr_count].current(0)
            if self.__is_column_show(i):
                getattr(self,
                        'entry_%ss' % property_name)[self.attr_count].grid(
                            row=self.attr_count + 1, column=i)

        getattr(self,
                'entry_types')[self.attr_count].bind('<<ComboboxSelected>>',
                                                     self.on_select)
        getattr(self, 'entry_inner_types')[self.attr_count].bind(
            '<<ComboboxSelected>>', self.on_select_inner)
        getattr(self, 'entry_inner_types')[self.attr_count]['state'] = DISABLED
        self.attr_count += 1
Exemplo n.º 33
0
    def createWidgets(self):
        self.mainFrame = Frame(self.parent)
        Label(self.mainFrame, text='2048 Game', font=(",30"),
              fg="#2980b9").pack(padx=20, pady=20)
        f1 = Frame(self.mainFrame)
        Label(f1, text='Grid').pack(side=LEFT, padx=5)
        Combobox(f1, textvariable=self.grid).pack(side=LEFT, padx=50)
        Button(f1, text='Play', command=self.play).pack(side=LEFT, padx=5)
        f1.pack(pady=10)

        self.winFrame = Frame(self.parent)
        Label(self.winFrame, text=' you win!', font=('', 30),
              fg='#e74c3c').pack(padx=20, pady=10)
        Label(self.winFrame,
              textvariable=self.moves,
              font=('', 30),
              fg='#e74c3c').pack()
        f2 = Frame(self.winFrame)
        Button(f2, text='play again', command=self.play).pack(side=LEFT,
                                                              padx=5)
        Button(f2, text='Cancel', command=self.showMainFrame).pack(side=LEFT,
                                                                   padx=5)
        f2.pack(pady=10)

        self.gameOverFrame = Frame(self.parent)
        Label(self.gameOverFrame,
              text='Gameover!',
              font=('', 30),
              fg='#e74c3c').pack(padx=20, pady=10)
        f2 = Frame(self.gameOverFrame)
        Button(f2, text='play again', command=self.play).pack(side=LEFT,
                                                              padx=5)
        Button(f2, text='Cancel', command=self.showMainFrame).pack(side=LEFT,
                                                                   padx=5)
        f2.pack(pady=10)
Exemplo n.º 34
0
        def _make_button_bar(self):
            self.button_upload = Button(self,
                                        text="Flash code",
                                        command=self.upload)
            self.button_upload.style = self.style
            self.button_upload.grid(row=0, column=0, padx=2, pady=2)

            self.baud_rate = 9600
            self.button_combobox = Combobox(self)
            self.button_combobox.bind("<<ComboboxSelected>>",
                                      self._update_baud_rate)
            bauds = (300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400,
                     57600, 115200)
            self.button_combobox['values'] = bauds
            self.button_combobox.current(4)
            self.button_combobox.grid(row=3, column=1, padx=2, pady=2)
Exemplo n.º 35
0
    def createBitFrame(self, bit):
        solCardBitFrm = Frame(self.solCardFrm, borderwidth = 5, relief=RAISED)
        self.bitFrms.append(solCardBitFrm)
        solCardBitFrm.grid(column = rs232Intf.NUM_SOL_PER_BRD - bit - 1, row = 0)
        tmpLbl = Label(solCardBitFrm, text="%s" % GameData.SolBitNames.SOL_BRD_BIT_NAMES[self.brdNum][bit])
        tmpLbl.grid(column = 0, row = 0, columnspan = 2)
        
        #Read config and set btnCfg
        cmdOffset = rs232Intf.CFG_BYTES_PER_SOL * bit
        holdOffset = cmdOffset + rs232Intf.DUTY_CYCLE_OFFSET
        if (GameData.SolBitNames.SOL_BRD_CFG[self.brdNum][cmdOffset] == rs232Intf.CFG_SOL_AUTO_CLR) or \
               (ord(GameData.SolBitNames.SOL_BRD_CFG[self.brdNum][holdOffset]) != 0):
            self.btnCfgBitfield |= (1 << bit)
        
        #Combobox menu for button presses
        self.indBitOptMenu.append(StringVar())
        if (self.btnCfgBitfield & (1 << bit)):
            self.indBitOptMenu[bit].set("Toggle")
        else:
            self.indBitOptMenu[bit].set("Pulse")
        tmpCB = Combobox(solCardBitFrm, textvariable=self.indBitOptMenu[bit], width=6, state="readonly")
        tmpCB["values"] = ("Pulse", "Toggle")
        tmpCB.grid(column = 0, row = 1, columnspan = 2)
        self.indBitOptMenu[bit].trace("w", lambda name, index, op, tmp=bit: self.comboboxcallback(tmp))
        
        #Button code
        if (self.btnCfgBitfield & (1 << bit)):
            #Toggle button so use the old style so button can stay pressed
            tmpBtn = Btn(solCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
            tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=8, pady=8)
        else:
            #Pulse button so use the new style
            tmpBtn = Button(solCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
            tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=4, pady=12)
        self.toggleBtn.append(tmpBtn)
        self.toggleState.append(False)
        
        tmpLbl = Label(solCardBitFrm, text="Value")
        tmpLbl.grid(column = 0, row = 3)
        self.indBitStatLbl.append(StringVar())
        self.indBitStatLbl[bit].set("0")
        tmpLbl = Label(solCardBitFrm, textvariable=self.indBitStatLbl[bit], relief=SUNKEN)
        tmpLbl.grid(column = 1, row = 3)

        #Button for pulsing solenoid
        tmpBtn = Button(solCardBitFrm, text="PulseSol", command=lambda tmp=bit: self.pulsesol(tmp))
        tmpBtn.grid(column = 0, row = 4, columnspan = 2, padx=4, pady=12)
Exemplo n.º 36
0
class LevelsWindow(Tk):
    def __init__(self, menu):
        Tk.__init__(self)
        
        self.title("Pick a level")
        
        icon = PhotoImage(file=os.getcwd() + '/res/logo/logo.gif')
        self.tk.call("wm", "iconphoto", self._w, icon)
        
        self.eval('tk::PlaceWindow %s center' % self.winfo_pathname(self.winfo_id()))
        
        self.levels = [file[:-4] for file in listdir("res/levels")]
        self.protocol("WM_DELETE_WINDOW", self.shutdownTTK)
        
        if not self.levels:  # No levels
            self.withdraw()
            tkMessageBox.showwarning("Error", 'There doesn\'t seem to be any levels saved. Create one pressing the "Design Level" button!')
            self.shutdownTTK()
            
        else:
            self.menu = menu
            
            self.value = StringVar()
            self.levels_list = Combobox(self, textvariable=self.value, state='readonly')
            
            self.levels_list['values'] = self.levels
            self.levels_list.current(0)
            self.levels_list.grid(column=0, row=0)
            
            self.button = Button(self, text="Begin Level", command=self.begin_level)
            self.button.grid(column=0, row=1)
            self.mainloop()
    
            
            
    def begin_level(self):
        level = self.levels_list.get()
        self.shutdownTTK()
        self.menu.call_to("GameWindow", level)
    
    
    def shutdownTTK(self):
        # For some unholy reason, TTK won't shut down when we destroy the window
        # so we have to explicitly kill it.
        self.eval('::ttk::CancelRepeat')
        self.destroy()
Exemplo n.º 37
0
class ComboBox(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()
        self.speed = 1.0

    def initUI(self):
        self.parent.title("Combobox")
        self.pack(fill=BOTH, expand=True)
        frame = Frame(self)
        frame.pack(fill=X)

        field = Label(frame, text="Typing Speed:", width=15)
        field.pack(side=LEFT, padx=5, pady=5)

        self.box_value = StringVar()
        self.box = Combobox(frame, textvariable=self.box_value, width=5)
        self.box['values'] = ('1x', '2x', '5x', '10x')
        self.box.current(0)
        self.box.pack(fill=X, padx=5, expand=True)
        self.box.bind("<<ComboboxSelected>>", self.value)

    def value(self, event):
        self.speed = float(self.box.get()[:-1])
Exemplo n.º 38
0
class FrOptions(LabelFrame):
    def __init__(self, title, txt, dicoprofils):
        LabelFrame.__init__(self, text=title)
        self.listing_profils(dicoprofils)

        # Dropdowm list of available profiles
        self.ddprofils = Combobox(self,
                                  values = dicoprofils.keys(),
                                  width = 35,
                                  height = len(dicoprofils.keys())*20)
        self.ddprofils.current(1)   # set the dropdown list to first element

        # export options
        caz_doc = Checkbutton(self, text = u'HTML / Word (.doc/.docx)',
                                    variable = self.master.opt_doc)
        caz_xls = Checkbutton(self, text = u'Excel 2003 (.xls)',
                                    variable = self.master.opt_xls)
        caz_xml = Checkbutton(self, text = u'XML (ISO 19139)',
                                    variable = self.master.opt_xml)

        # Basic buttons
        self.action = StringVar()
        self.action.set(txt.get('gui_choprofil'))
        self.val = Button(self, textvariable = self.action,
                                relief= 'raised',
                                command = self.bell)
        can = Button(self, text = 'Cancel (quit)',
                                relief= 'groove',
                                command = self.master.destroy)
        # Widgets placement
        self.ddprofils.bind('<<ComboboxSelected>>', self.alter_val)
        self.ddprofils.grid(row = 1, column = 0, columnspan = 3, sticky = N+S+W+E, padx = 2, pady = 5)
        caz_doc.grid(row = 2, column = 0, sticky = N+S+W, padx = 2, pady = 1)
        caz_xls.grid(row = 3, column = 0, sticky = N+S+W, padx = 2, pady = 1)
        caz_xml.grid(row = 4, column = 0, sticky = N+S+W, padx = 2, pady = 1)
        self.val.grid(row = 5, column = 0, columnspan = 2,
                            sticky = N+S+W+E, padx = 2, pady = 5)
        can.grid(row = 5, column = 2, sticky = N+S+W+E, padx = 2, pady = 5)

    def listing_profils(self, dictprofils):
        u""" List existing profilesin folder \data\profils """
        for i in glob(r'../data/profils/*.xml'):
            dictprofils[path.splitext(path.basename(i))[0]] = i
##        if new > 0:
##            listing_lang()
##            load_textes(deroul_lang.get())
##            deroul_profils.setlist(sorted(dico_profils.keys()))
##            fen_choix.update()
        # End of function
        return dictprofils

    def alter_val(self, inutile):
        u""" Switch the label of the validation button contained in basics class
        in the case that a new profile is going to be created"""
        if self.ddprofils.get() == self.master.blabla.get('gui_nouvprofil'):
            self.action.set(self.master.blabla.get('gui_crprofil'))
        else:
            self.action.set(self.master.blabla.get('gui_choprofil'))
        # End of functionFin de fonction
        return self.action
Exemplo n.º 39
0
    def setPerfil(self, name):
        global img
        img_ = Image.open("Images/profile.png")
        img_.thumbnail((80, 80), Image.ANTIALIAS)
        img = ImageTk.PhotoImage(img_)

        Label(self.frameMenu,
              foreground="#66CD00",
              background="#B4CDCD",
              font=("Arial", 12, "bold"),
              image=img,
              compound=LEFT).pack(side=LEFT)
        self.cb = Combobox(self.frameMenu, width=18)
        self.cb.pack(side=LEFT, fill=X)
        values = ("Israel Gomes", "Andreza Dantas", "Sandra Noronha")
        self.cb.config(value=values)
        self.cb.config(state="readonly", style="C.TCombobox")
        self.cb.set(values[0])
Exemplo n.º 40
0
 def __init__(self, master=None, combobox_callback=None):
     Frame.__init__(self, master=master)
     self.__cb_stringvar = StringVar()
     self.__combobox = Combobox(
         master=self, textvariable=self.__cb_stringvar)
     if combobox_callback and callable(combobox_callback):
         self.__cb_stringvar.trace('w', self.__combobox_chang)
         self.__user_call_back = combobox_callback
     self.__combobox.pack()
Exemplo n.º 41
0
    def __init__(self,root):
	root.title("Connect Four") 
	self.turn= 1 
	self.last_piece= None
	self.p1= None
	self.p2= None

	frame = Frame(root)
	frame.pack(side=TOP)

	label1 = Label(frame, text="Player 1:")
	label1.pack(side= LEFT)
	
	self.combobox = Combobox(frame, values= ('Human', 'Minimax', 'Random'))
        self.combobox.pack(side=LEFT)

	label2 = Label(frame, text="Player 2:")
        label2.pack(side=LEFT)

	self.combobox1 = Combobox(frame, values= ('Human', 'Minimax','Random'))
        self.combobox1.pack(side= LEFT)

	frame2= Frame(root)
	frame2.pack(side=TOP)

	label3= Label(frame2, text= "(If Minimax Chosen) Ply-Depth:")
	label3.pack(side= LEFT) 
	
	self.spinner = Spinbox(frame2,width=5,from_=2, to=5)
	self.spinner.pack(side= LEFT ) 

	playbutton = Button(frame2, text= "Start Game", command= self.play_game) 
	playbutton.pack(side= LEFT, padx= 20) 

	frame1= Frame(root)
	frame1.pack(side=TOP)

	for x in range(7):
	    button0 = Button(frame1, text= "Column %i" %(x+1), command = functools.partial(self.human_turn,x))
	    button0.grid(row=0, column= x) 
	
	self.b= connectfour.ConnectFour()
	self.board= Canvas(frame1, width= 705, height= 605)
	self.board.grid(row= 1, columnspan=7) 
Exemplo n.º 42
0
    def create_ingredient_fields(self, frame, rownum):
        if rownum not in self.ingredients_info['ingredients'][1]:
            self.ingredients_info['ingredients'][1][rownum] = [None, None]

        ing_frame = LabelFrame(frame, text="Ingredient %s" % (rownum + 1))
        ing_frame.grid(row=rownum, column=0, padx=10, pady=10, sticky=N+S+W+E)
        ing_frame.grid_rowconfigure(0, weight=1)
        ing_frame.grid_columnconfigure(0, weight=1)
        ing_frame.grid_columnconfigure(1, weight=10)

        space_label = Label(ing_frame, text="")
        space_label.grid(row=0, column=0, pady=5, sticky=W)

        name_label = Label(ing_frame, text="Ingredient Name")
        name_label.grid(row=1, column=0, columnspan=2, padx=10, pady=2, sticky=W)
        name_value = StringVar()
        if rownum in self.ingredients_info['ingredients'][0]:
            name_value.set(self.ingredients_info['ingredients'][0][rownum][0])
        name_box = Entry(ing_frame, textvariable=name_value)
        name_box.grid(row=2, column=0, columnspan=2, padx=10, pady=2, sticky=W)

        param_label = Label(ing_frame, text="Ingredient Parameters")
        param_label.grid(row=3, column=0, columnspan=2, padx=10, pady=2, sticky=W)

        key_option_val  = StringVar(ing_frame)
        key_option_val.set(self.keywords[0][0])
        key_option_menu = Combobox(ing_frame, textvariable=key_option_val, state='readonly')
        key_option_menu['values'] = [key for key, value in self.keywords]
        key_option_menu.grid(row=4, column=0, sticky=W, pady=10, padx=10)
        add_key_btn = Button(ing_frame, text="+")
        add_key_btn.grid(row=4, column=1, padx=10, pady=10, sticky=W)
        self.key_boxes[rownum] = key_option_val

        param_box = Text(ing_frame, height=5, width=80)
        if rownum in self.ingredients_info['ingredients'][0]:
            param_box.insert('1.0', self.ingredients_info['ingredients'][0][rownum][1])
        param_box.grid(row=5, column=0, columnspan=2, padx=10, pady=2, sticky=W)


        space_label = Label(ing_frame, text="")
        space_label.grid(row=5, column=0, pady=5, sticky=W)
        add_key_btn.configure(command=lambda:self.add_param_text(param_box, key_option_val))
        self.ingredients_info['ingredients'][1][rownum] = [name_value, param_box]
Exemplo n.º 43
0
 def createBitFrame(self, bit):
     inpCardBitFrm = Frame(self.inpCardFrm, borderwidth = 5, relief=RAISED)
     self.bitFrms.append(inpCardBitFrm)
     if (bit < TkInpBrd.BITS_IN_ROW):
         inpCardBitFrm.grid(column = TkInpBrd.BITS_IN_ROW - bit - 1, row = 0)
     else:
         inpCardBitFrm.grid(column = rs232Intf.NUM_INP_PER_BRD - bit - 1, row = 1)
     tmpLbl = Label(inpCardBitFrm, text="%s" % GameData.InpBitNames.INP_BRD_BIT_NAMES[self.brdNum][bit])
     tmpLbl.grid(column = 0, row = 0, columnspan = 2)
     
     #Read config and set btnCfg
     if (GameData.InpBitNames.INP_BRD_CFG[self.brdNum][bit] == rs232Intf.CFG_INP_STATE):
         self.btnCfgBitfield |= (1 << bit)
     
     #Combobox menu for button presses
     self.indBitOptMenu.append(StringVar())
     if (self.btnCfgBitfield & (1 << bit)):
         self.indBitOptMenu[bit].set("Toggle")
     else:
         self.indBitOptMenu[bit].set("Pulse")
     tmpCB = Combobox(inpCardBitFrm, textvariable=self.indBitOptMenu[bit], width=6, state="readonly")
     tmpCB["values"] = ("Pulse", "Toggle")
     tmpCB.grid(column = 0, row = 1, columnspan = 2)
     self.indBitOptMenu[bit].trace("w", lambda name, index, op, tmp=bit: self.comboboxcallback(tmp))
     
     #Button code
     if (self.btnCfgBitfield & (1 << bit)):
         #Toggle button so use the old style so button can stay pressed
         tmpBtn = Btn(inpCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
         tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=8, pady=8)
     else:
         #Pulse button so use the new style
         tmpBtn = Button(inpCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
         tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=4, pady=12)
     self.toggleBtn.append(tmpBtn)
     self.toggleState.append(False)
     tmpLbl = Label(inpCardBitFrm, text="Value")
     tmpLbl.grid(column = 0, row = 3)
     self.indBitStatLbl.append(StringVar())
     self.indBitStatLbl[bit].set("0")
     tmpLbl = Label(inpCardBitFrm, textvariable=self.indBitStatLbl[bit], relief=SUNKEN)
     tmpLbl.grid(column = 1, row = 3)
Exemplo n.º 44
0
    def initgui(self):
        self.root.title("Tick tack toe")
        self.root.resizable(False, False)
        self.frame_board = Frame(self.root, bg="black")
        self.canvas = Canvas(self.frame_board,
                             width=600,
                             height=600,
                             bg="beige")

        self.frame_options = Frame(self.root)
        self.button_setup = Button(self.frame_options, text="Setup", width=10)
        self.button_start = Button(self.frame_options, text="Start", width=10)
        self.button_reset = Button(self.frame_options, text="Reset", width=10)
        self.button_reload = Button(self.frame_options,
                                    text="Load Bots",
                                    width=10)
        self.button_test = Button(self.frame_options, text="Test", width=10)

        self.entry_test = Entry(self.frame_options, width=10)

        self.label1 = Label(self.frame_options, text="Player 1")
        self.label2 = Label(self.frame_options, text="Player 2")
        self.combo1 = Combobox(self.frame_options, state="readonly")
        self.combo2 = Combobox(self.frame_options, state="readonly")

        self.entry_shape1 = Entry(self.frame_options, width=5)
        self.entry_shape2 = Entry(self.frame_options, width=5)

        self.label_size = Label(self.frame_options, text="Board Size")
        self.entry_size = Entry(self.frame_options, width=10)

        self.label_movements = Label(self.frame_options, text="Steps")
        self.movements = Listbox(self.frame_options, width=25, height=15)

        self.chainVar = 0
        self.button_chain = Button(self.frame_options,
                                   text="Show Chains",
                                   width=10)

        self.button_help = Button(self.frame_options, text="?", width=3)
        self.label_version = Label(self.frame_options,
                                   text="Version v" + self.version)
Exemplo n.º 45
0
    def init_ui(self):
        self.parent_.title('Rough surface generator')
        self.pack(fill=BOTH, expand=True)

        # top panel with controls
        frame_top = Frame(self, background=self.TOP_FRAME_BACKGROUND_COLOR)
        frame_top.pack(fill=X)

        self.cb = Combobox(frame_top, values=('Gaussian', 'Laplace'))
        self.cb.current(0)
        self.cb.pack(side=LEFT, padx=5, expand=True)

        l1 = Label(frame_top, text=r'Cx', background=self.TOP_FRAME_BACKGROUND_COLOR, width=4)
        l1.pack(side=LEFT, padx=5, expand=True)

        self.entry1 = Entry(frame_top,
                            validate='key',
                            validatecommand=(self.register(self.on_validate),
                                             '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'),
                            width=10)
        self.entry1.pack(side=LEFT, padx=5, expand=True)
        self.entry1.insert(0, str(self.a_))

        l1 = Label(frame_top, text=r'Cy', width=4, background=self.TOP_FRAME_BACKGROUND_COLOR)
        l1.pack(side=LEFT, padx=5)

        self.entry2 = Entry(frame_top,
                            validate='key',
                            validatecommand=(self.register(self.on_validate),
                                             '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'),
                            width=10)
        self.entry2.pack(side=LEFT, padx=5, expand=True)
        self.entry2.insert(0, str(self.b_))

        but1 = Button(frame_top, text='RUN', command=self.button_action)
        but1.pack(side=RIGHT, padx=5, pady=5)

        # central panel. It will have a label with an image. Image may have a random noise state, or
        # transformed image state
        self.img_frame.pack(fill=BOTH, expand=True)
        img_label = Label(self.img_frame, background=None)
        img_label.pack(expand=True, fill=BOTH, padx=5, pady=5)
Exemplo n.º 46
0
 def body(self, master):
     self._npFrame = LabelFrame(master, text='Annotation window text')
     self._npFrame.pack(fill=X)
     self._fontFrame = Frame(self._npFrame, borderwidth=0)
     self._fontLabel = Label(self._fontFrame, text='Font:', width=5)
     self._fontLabel.pack(side=LEFT, padx=3)
     self._fontCombo = Combobox(self._fontFrame, values=sorted(families()),
                                state='readonly')
     self._fontCombo.pack(side=RIGHT, fill=X)
     self._sizeFrame = Frame(self._npFrame, borderwidth=0)
     self._sizeLabel = Label(self._sizeFrame, text='Size:', width=5)
     self._sizeLabel.pack(side=LEFT, padx=3)
     self._sizeCombo = Combobox(self._sizeFrame, values=range(8,15),
                                state='readonly')
     self._sizeCombo.pack(side=RIGHT, fill=X)
     self._fontFrame.pack()
     self._sizeFrame.pack()
     self._npFrame.pack(fill=X)
     self._fontCombo.set(self.font)
     self._sizeCombo.set(self.size)
Exemplo n.º 47
0
        def _make_button_bar(self):
            self.button_upload = Button(self, text="Flash code", command=self.upload)
            self.button_upload.style = self.style
            self.button_upload.grid(row=0, column=0, padx=2, pady=2)

            self.baud_rate = 9600
            self.button_combobox = Combobox(self)
            self.button_combobox.bind("<<ComboboxSelected>>", self._update_baud_rate)
            bauds = (300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200)
            self.button_combobox['values'] = bauds
            self.button_combobox.current(4)
            self.button_combobox.grid(row=3, column=1, padx=2, pady=2)
Exemplo n.º 48
0
    def show(self, line=None):
        '''
        allows preset values
        '''
        self.setup() #base class setup

        self.frame = Frame(self.root)

        # blow out the field every time this is created
        if not self.edit: self.date.set(date.today().strftime("%m/%d/%Y"))
        
        ### dialog content        
        Label(self.frame, text="First Name: ").grid(row=0, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Middle Initial: ").grid(row=1, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Last Name: ").grid(row=2, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Customer Type: ").grid(row=3, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Date (mm/dd/yyyy): ").grid(row=4, sticky=W, ipady=2, pady=2)

        self.fname_en = Entry(self.frame, width=30, textvariable=self.fname)
        self.mname_en = Entry(self.frame, width=30, textvariable=self.mname)
        self.lname_en = Entry(self.frame, width=30, textvariable=self.lname)
        self.payment_cb = Combobox(self.frame, textvariable=self.payment, width=27,
                                   values=("Drop In", "Punch Card", "Monthly", "Inactive"))
        self.payment_cb.set("Drop In")
        self.date_en = Entry(self.frame, width=30, textvariable=self.date)

        Frame(self.frame, width=5).grid(row=0,column=1,sticky=W)
        
        self.fname_en.grid(row=0,column=2,columnspan=2,sticky=W)
        self.mname_en.grid(row=1,column=2,columnspan=2,sticky=W)
        self.lname_en.grid(row=2,column=2,columnspan=2,sticky=W)
        self.payment_cb.grid(row=3,column=2,columnspan=2,sticky=W)
        self.date_en.grid(row=4,column=2,columnspan=2,sticky=W)
        
        ### buttons
        Button(self.frame, text='Cancel', width=10,
               command=self.wm_delete_window).grid(row=5, column=2, sticky=W, padx=10, pady=3)
        Button(self.frame, text='Submit', width=10,
               command=self.add_customer).grid(row=5, column=3, sticky=W)
        self.frame.pack(padx=10, pady=10)

        self.root.bind("<Return>", self.add_customer)
        self.fname_en.focus_set()

        if line: #preset values
            self.fname.set(line[1])
            self.mname.set(line[2])
            self.lname.set(line[0])
            self.payment_cb.set(line[3])
            self.date.set(line[4].strftime("%m/%d/%Y"))
        
        ### enable from base class
        self.enable()
Exemplo n.º 49
0
    def body(self, master):
        """Creates select game window.

        :param master: instance - master widget instance
        :return: Entry instance
        """
        self.resizable(False, False)
        Label(master, text='Type in new game title or select existing one').grid(row=0, columnspan=2)
        Label(master, text='Select game:').grid(row=1, sticky='W')
        Label(master, text='Number of players:').grid(row=2, sticky='W')
        Label(master, text='Game duration:').grid(row=3, sticky='W')
        self.select_game = Combobox(master)
        self.select_game.bind('<Button-1>', self.refresh_games)
        self.select_game.grid(row=1, column=1, sticky='W')
        self.num_players = Entry(master)
        self.num_players.insert(END, self.parent.num_players if self.parent.num_players else '')
        self.num_players.grid(row=2, column=1, sticky='W')
        self.num_turns = Entry(master)
        self.num_turns.insert(END, self.parent.num_turns if self.parent.num_turns else '')
        self.num_turns.grid(row=3, column=1, sticky='W')
        return self.select_game
Exemplo n.º 50
0
class PreferencesDialog(Dialog):
    def __init__(self, parent, title, font, size):
        self._master = parent
        self.result = False
        self.font = font
        self.size = size
        Dialog.__init__(self, parent, title)

    def body(self, master):
        self._npFrame = LabelFrame(master, text='Annotation window text')
        self._npFrame.pack(fill=X)
        self._fontFrame = Frame(self._npFrame, borderwidth=0)
        self._fontLabel = Label(self._fontFrame, text='Font:', width=5)
        self._fontLabel.pack(side=LEFT, padx=3)
        self._fontCombo = Combobox(self._fontFrame,
                                   values=sorted(families()),
                                   state='readonly')
        self._fontCombo.pack(side=RIGHT, fill=X)
        self._sizeFrame = Frame(self._npFrame, borderwidth=0)
        self._sizeLabel = Label(self._sizeFrame, text='Size:', width=5)
        self._sizeLabel.pack(side=LEFT, padx=3)
        self._sizeCombo = Combobox(self._sizeFrame,
                                   values=range(8, 15),
                                   state='readonly')
        self._sizeCombo.pack(side=RIGHT, fill=X)
        self._fontFrame.pack()
        self._sizeFrame.pack()
        self._npFrame.pack(fill=X)
        self._fontCombo.set(self.font)
        self._sizeCombo.set(self.size)

    def apply(self):
        self.font = self._fontCombo.get()
        self.size = self._sizeCombo.get()
        self.result = True

    def cancel(self, event=None):
        if self.parent is not None:
            self.parent.focus_set()
        self.destroy()
Exemplo n.º 51
0
class ComboBox(Frame):
    def __init__(self, root, *args, **kwargs):
        label_kwargs = dict(text=kwargs.pop('label', ''))
        combobox_kwargs = dict()
        combobox_kwargs['state'] = kwargs.pop('state', 'normal')
        combobox_kwargs['textvariable'] = kwargs.pop('textvariable', None)

        Frame.__init__(self, root, *args, **kwargs)

        self.label = Label(self, **label_kwargs)
        self.combobox = Combobox(self, **combobox_kwargs)
        self.values = list()

        self.label.pack(side=LEFT)
        self.combobox.pack(side=RIGHT)

    def insert(self, position, value):
        if position.lower() == 'end':
            self.values.append(value)
        else:
            self.values.insert(int(position), value)
        self.combobox['values'] = self.values
Exemplo n.º 52
0
 def body(self, master):
     self._npFrame = LabelFrame(master, text='Annotation window text')
     self._npFrame.pack(fill=X)
     self._fontFrame = Frame(self._npFrame, borderwidth=0)
     self._fontLabel = Label(self._fontFrame, text='Font:', width=5)
     self._fontLabel.pack(side=LEFT, padx=3)
     self._fontCombo = Combobox(self._fontFrame,
                                values=sorted(families()),
                                state='readonly')
     self._fontCombo.pack(side=RIGHT, fill=X)
     self._sizeFrame = Frame(self._npFrame, borderwidth=0)
     self._sizeLabel = Label(self._sizeFrame, text='Size:', width=5)
     self._sizeLabel.pack(side=LEFT, padx=3)
     self._sizeCombo = Combobox(self._sizeFrame,
                                values=range(8, 15),
                                state='readonly')
     self._sizeCombo.pack(side=RIGHT, fill=X)
     self._fontFrame.pack()
     self._sizeFrame.pack()
     self._npFrame.pack(fill=X)
     self._fontCombo.set(self.font)
     self._sizeCombo.set(self.size)
Exemplo n.º 53
0
    def __init__(self,master,customers,payments,output_text):
        Frame.__init__(self,master)
        self.customers = customers
        self.payments = payments
        self.master = master
        self.output_text = output_text

        self.year_months = find_years_months(getcwd()) # use cwd, this should be set

        self.year = StringVar()
        self.month = StringVar()
        self.years = sorted(self.year_months.keys())
        self.months = []

        lf = LabelFrame(self, text="Generate Report")
        lf.grid(padx=5,pady=5,row=0,column=0,sticky='ew')

        Label(lf,text="Year: ").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
        Label(lf,text="Month: ").grid(row=1,column=0,sticky='e',padx=(10,0),pady=2)

        self.year_cb = Combobox(lf,textvariable=self.year,width=12,values=self.years,state='readonly')
        self.month_cb = Combobox(lf,textvariable=self.month,width=12,values=self.months,state='readonly')
        
        self.year_cb.grid(row=0,column=1,sticky='w',padx=(0,10),pady=(10,2))
        self.month_cb.grid(row=1,column=1,sticky='w',padx=(0,10),pady=2)

        btn = Button(lf,text="Save Report",command=self.report,width=30)
        btn.grid(row=2,column=0,columnspan=2,sticky='n',pady=(2,10),padx=10)

        #configure the grid to expand
        self.columnconfigure(0,weight=1)
        lf.rowconfigure(0,weight=1)
        lf.rowconfigure(1,weight=1)
        lf.columnconfigure(0,weight=1)
        lf.columnconfigure(1,weight=1)

        self.year_cb.bind('<<ComboboxSelected>>',self.year_selected)

        self.update() #update the values
Exemplo n.º 54
0
 def _add_choice(self, frame, index, name, choices, default, option):
     self.function[-1] = lambda v: [option, v]
     label = Label(frame, text=name)
     label.grid(row=index, column=0, sticky="W", padx=10)
     field = Combobox(frame, values=choices, state="readonly")
     field.set(default)
     field.grid(row=index, column=1, sticky="WE")
     self.variables[-1] = field
Exemplo n.º 55
0
    def __init__(self, master=None, main=None):
        Frame.__init__(self, master)

        self.parent = master
        self.main = main

        self.parent.geometry("280x174")
        self.parent.title(os.getenv("NAME") + " - Advance Board Config")
        self.master.configure(padx=10, pady=10)

        self.HEAPSIZE = {"512 byte": 512,
                         "1024 byte": 1024,}
        self.OPTIMIZATION = "-O2 -O3 -Os".split()

        self.mips16_var = IntVar()
        self.checkBox_mips16 = Checkbutton(self.parent, text="Mips16", anchor="w", variable=self.mips16_var)
        self.checkBox_mips16.pack(expand=True, fill=BOTH, side=TOP)

        frame_heap = Frame(self.parent)
        Label(frame_heap, text="Heap size:", anchor="w", width=12).pack(side=LEFT, fill=X, expand=True)
        self.comboBox_heapsize = Combobox(frame_heap, values=self.HEAPSIZE.keys())
        self.comboBox_heapsize.pack(fill=X, expand=True, side=RIGHT)
        frame_heap.pack(fill=X, expand=True, side=TOP)

        frame_opt = Frame(self.parent)
        Label(frame_opt, text="Optimization:", anchor="w", width=12).pack(side=LEFT, fill=X, expand=True)
        self.comboBox_optimization = Combobox(frame_opt, values=self.OPTIMIZATION)
        self.comboBox_optimization.pack(fill=X, expand=True, side=RIGHT)
        frame_opt.pack(fill=X, expand=True, side=TOP)

        frame_buttons = Frame(self.parent)
        Button(frame_buttons, text="Accept", command=self.accept_config).pack(fill=X, expand=True, side=LEFT)
        Button(frame_buttons, text="Restore Default", command=self.restore_default).pack(fill=X, expand=True, side=RIGHT)
        frame_buttons.pack(fill=X, expand=True, side=BOTTOM)

        self.load_config()
Exemplo n.º 56
0
        def make_bottom_right(parent):
            try:
                # If the ttk combo-box widget is available, use it for the
                # Types field.  Otherwise, create one out of other Tk widgets.
                from ttk import Combobox
                itypes = [ ' ' + t for t in cap_item_types ]
                self.type_ent = Combobox(parent, values=itypes,
                                         width=(query_entry_width - 6),
                                         height=len(itypes))
                self.ttk_type_entry = 1
                return self.type_ent
            except:
                self.ttk_type_entry = 0    # ttk not present

            bottom_right = Frame(parent)
            self.type_ent = entry_widget(bottom_right,
                                         width=(query_entry_width - 6))
            self.type_ent.pack(side=LEFT, fill=X, expand=YES)
            self.types_pulldown_button = \
                Button(bottom_right, text=u_triagdn, pady=0, anchor=S,
                       command=EventHandler('Display file type list',
                                            self.types_pull_down))
            self.types_pulldown_button.pack(side=LEFT, padx=2)
            return bottom_right