当前位置: 首页>>代码示例>>Python>>正文


Python ttk.Entry类代码示例

本文整理汇总了Python中ttk.Entry的典型用法代码示例。如果您正苦于以下问题:Python Entry类的具体用法?Python Entry怎么用?Python Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Entry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CommAdd

class CommAdd(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
        # This should be different if running on Windows....
        content = pyperclip.paste()
        print content  
        self.entries_found = []

        self.parent.title("Add a new command card")
        self.style = Style()
        self.style.theme_use("default")        
        self.pack()
        
        self.new_title_label = Label(self, text="Title")
        self.new_title_label.grid(row=0, columnspan=2)
        self.new_title_entry = Entry(self, width=90)
        self.new_title_entry.grid(row=1, column=0)
        self.new_title_entry.focus()
        self.new_content_label = Label(self, text="Card")
        self.new_content_label.grid(row=2, columnspan=2)
        self.new_content_text = Text(self, width=110, height=34)
        self.new_content_text.insert(END, content)
        self.new_content_text.grid(row=3, columnspan=2)
        self.add_new_btn = Button(self, text="Add New Card", command=self.onAddNew)
        self.add_new_btn.grid(row=4)

    def onAddNew(self):

        pass
开发者ID:angelalonso,项目名称:comm,代码行数:35,代码来源:comm.py

示例2: Example

class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Please enter company name")
        
        Style().configure("TButton", padding=(0, 20, 0, 20), width=60)
        Style().configure("TLabel", padding=(3, 3, 3, 3))
        Style().configure("TEntry", padding=(0, 5, 0, 5))
        self.columnconfigure(0, pad=3)
        self.columnconfigure(1, pad=3)
        self.columnconfigure(2, pad=3)
        self.columnconfigure(3, pad=3)
        
        self.rowconfigure(0, pad=3)
        self.rowconfigure(1, pad=3)
        self.rowconfigure(2, pad=3)
        self.rowconfigure(3, pad=3)
        self.rowconfigure(4, pad=3)
        self.label = Label(self, text="Company Name")
        self.entry = Entry(self)
        self.entry.grid(row=0, columnspan=4, sticky=W+E)
        cls = Button(self, text="OK", command=self.quit)
        cls.grid(row=1, column=0)
        self.pack()
开发者ID:leetncamp,项目名称:portal,代码行数:32,代码来源:ask.py

示例3: TabServices

class TabServices(Frame):

    def __init__(self, parent, txt=dict()):
        """Instanciating the output workbook."""
        self.parent = parent
        Frame.__init__(self)

        # variables
        self.url_srv = StringVar(self,
                                 'http://suite.opengeo.org/geoserver/wfs?request=GetCapabilities')

        # widgets
        self.lb_url_srv = Label(self,
                                text='Web service URL GetCapabilities: ')
        self.ent_url_srv = Entry(self,
                                 width=75,
                                 textvariable=self.url_srv)
        self.btn_check_srv = Button(self, text="youhou")
        # widgets placement
        self.lb_url_srv.grid(row=0, column=0,
                             sticky="NSWE", padx=2, pady=2)
        self.ent_url_srv.grid(row=0, column=1,
                              sticky="NSWE", padx=2, pady=2)
        self.btn_check_srv.grid(row=0, column=2,
                                sticky="NSWE", padx=2, pady=2)
开发者ID:Guts,项目名称:DicoGIS,代码行数:25,代码来源:tab_geoservices.py

示例4: __initializeComponents

 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)
开发者ID:jsikorski,项目名称:HCC-tablet-data-presenter,代码行数:59,代码来源:interface.py

示例5: MainFrame

class MainFrame(Frame):    
    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()    
              
    def initUI(self):
        self.parent.title("Driver Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.label = Label(self, text="Bus Tracker - Driver", font=('Helvetica', '21'))
        self.label.grid(row=0, column=0)

        self.l = Label(self, text="Bus Line", font=('Helvetica', '18'))
        self.l.grid(row=1, column=0)
        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=2, column=0)

        self.l = Label(self, text="Direction", font=('Helvetica', '18'))
        self.l.grid(row=3, column=0)

        # add vertical space
        self.l = Label(self, text="", font=('Helvetica', '14'))
        self.l.grid(row=5, column=0)

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Start")
        self.search.grid(row=6, column=0)   
        
        
        ######### used for debug ##########
        # add vertical space
        self.l2 = Label(self, text="", font=('Helvetica', '14'))
        self.l2.grid(row=5, column=0)
        
        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=6, column=0)    
        
        self.startBtn = Button(self, text="Start")
        self.startBtn["command"] = self.start 
        self.startBtn.grid(row=7, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=8, column=0)   
        
    def turnOn(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOn", "busId":DRIVERID, "localIP":IP, "localPort":int(PORT)})
        
    def start(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"start", "route":ROUTNO, "direction":"north", "location":(0,0)})
        
    def turnOff(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOff"})    
开发者ID:Tianwei-Li,项目名称:DS-Bus-Tracker,代码行数:58,代码来源:gui_driver.py

示例6: Login

class Login(Frame):
    """******** Funcion: __init__ **************
    Descripcion: Constructor de Login
    Parametros:
    self Login
    parent Tk
    Retorno: void
    *****************************************************"""
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()


    """******** Funcion: initUI **************
    Descripcion: Inicia la interfaz grafica de un Login,
                para ello hace uso de Frames y Widgets.
    Parametros:
    self Login
    Retorno: void
    *****************************************************"""
    def initUI(self):
        self.parent.title("Pythagram: Login")
        self.style = Style()
        self.style.theme_use("default")

        self.frame = Frame(self, relief=RAISED)
        self.frame.pack(fill=BOTH, expand=1)
        self.instructions = Label(self.frame,text="A new Web Browser window will open, you must log-in and accept the permissions to use this app.\nThen you have to copy the code that appears and paste it on the next text box.")
        self.instructions.pack(fill=BOTH, padx=5,pady=5)
        self.codeLabel = Label(self.frame,text="Code:")
        self.codeLabel.pack(fill=BOTH, padx=5,pady=5)
        self.codeEntry = Entry(self.frame)
        self.codeEntry.pack(fill=BOTH, padx=5,pady=5)
        self.pack(fill=BOTH, expand=1)

        self.closeButton = Button(self, text="Cancel", command=self.quit)
        self.closeButton.pack(side=RIGHT, padx=5, pady=5)
        self.okButton = Button(self, text="OK", command=self.login)
        self.okButton.pack(side=RIGHT)

    """******** Funcion: login **************
    Descripcion: Luego que el usuario ingresa su codigo de acceso, hace
                la solicitud al servidor para cargar su cuenta en una
                ventana de tipo Profile
    Parametros:
    self
    Retorno: Retorna...
    *****************************************************"""
    def login(self):
        code = self.codeEntry.get()
        api = InstagramAPI(code)
        raw = api.call_resource('users', 'info', user_id='self')
        data = raw['data']
        self.newWindow = Toplevel(self.parent)
        global GlobalID
        GlobalID = data['id']
        p = Profile(self.newWindow,api,data['id'])
开发者ID:ncyrcus,项目名称:tareas-lp,代码行数:58,代码来源:gui.py

示例7: __init__

 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.Entry
     """
     Entry.__init__(self, parent, **kwargs)
     self.configure(background=DEFAULT_BACKGROUND)
开发者ID:benjohnston24,项目名称:stdtoolbox,代码行数:9,代码来源:stdGUI.py

示例8: add_file_browser

	def add_file_browser(self, f, button_txt, init_txt , r, c, help_txt=''):
		b = Button(f,text=button_txt)
		b.grid(row=r, column=c, sticky=W+E)
		f_var = StringVar()
		f_var.set(init_txt)
		e = Entry(f, textvariable=f_var)
		e.grid(row=r, column=c+1)
		b.configure(command=lambda: self.browse_file(f_var, b))
		return f_var
开发者ID:MarkMenagie,项目名称:EMR-pre-processing-pipeline,代码行数:9,代码来源:report.py

示例9: initUI

    def initUI(self):
        self.parent.title("User Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.label = Label(self, text="Mobile Live Bus Tracker", font=('Helvetica', '21'))
        self.label.grid(row=0, column=0)

        self.l = Label(self, text="My Location", font=('Helvetica', '18'))
        self.l.grid(row=1, column=0)
        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=2, column=0)

        self.l = Label(self, text="Destination", font=('Helvetica', '18'))
        self.l.grid(row=3, column=0)

        # add vertical space
        self.l = Label(self, text="", font=('Helvetica', '14'))
        self.l.grid(row=5, column=0)

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Search")
        self.search.grid(row=6, column=0)       

        # For second screen (after user searched)
        # add vertical space
        self.l = Label(self, text="", font=('Helvetica', '14'))
        self.l.grid(row=7, column=0)

        self.l = Label(self, text="Pick a bus line", font=('Helvetica', '18'))
        self.l.grid(row=8, column=0)  
        
        self.search = Button(self, text="61A", width=40)
        self.search.grid(row=9, column=0)
        self.search = Button(self, text="61B", width=40)
        self.search.grid(row=10, column=0)
        self.search = Button(self, text="61C", width=40)
        self.search.grid(row=11, column=0)
        
        
        ############## used for debug ################
        self.l2 = Label(self, text="", font=('Helvetica', '14'))
        self.l2.grid(row=12, column=0)
        
        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=13, column=0)    
        
        self.reqBtn = Button(self, text="Request")
        self.reqBtn["command"] = self.request 
        self.reqBtn.grid(row=14, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=15, column=0)   
开发者ID:Tianwei-Li,项目名称:DS-Bus-Tracker,代码行数:57,代码来源:gui_user.py

示例10: init_ui

    def init_ui(self):
        self.parent.title("Information Theory")
        Style().configure("TButton", padding=(0, 5, 0, 5), font='Verdana 10')

        self.columnconfigure(0, pad=3)
        self.columnconfigure(1, pad=3)
        self.columnconfigure(2, pad=3)
        self.columnconfigure(3, pad=3)
        self.columnconfigure(4, pad=3)

        self.rowconfigure(0, pad=3)
        self.rowconfigure(1, pad=3)
        self.rowconfigure(2, pad=3)
        self.rowconfigure(3, pad=3)
        self.rowconfigure(4, pad=3)
        self.rowconfigure(5, pad=3)

        string_to_search_label = Label(self, text="Search a string: ")
        string_to_search_label.grid(row=0, column=0, rowspan=2)
        self.string_to_search_textfield = Entry(self)
        self.string_to_search_textfield.grid(row=0, column=1, rowspan=2, columnspan=2, sticky=W)
        self.string_to_search_textfield.bind('<Return>', self.get_string_from_textfield)
        self.compression_ratio_text = StringVar()
        self.compression_ratio_text.set('Compression Ratio: ')
        compression_ratio_label = Label(self, textvariable=self.compression_ratio_text).grid(row=0, column=2,
                                                                                             columnspan=4)

        Separator(self, orient=HORIZONTAL).grid(row=1)
        string_to_encode_label = Label(self, text="Encode a string: ")
        string_to_encode_label.grid(row=2, column=0, rowspan=2)
        self.string_to_encode_textfield = Entry(self)
        self.string_to_encode_textfield.grid(row=2, column=1, rowspan=2, columnspan=2, sticky=W)
        self.string_to_encode_textfield.bind('<Return>', self.get_string_from_textfield_to_encode)

        Separator(self, orient=HORIZONTAL).grid(row=3)
        self.area = Text(self)
        self.area.grid(row=4, column=0, columnspan=3, rowspan=1, padx=5, sticky=E + W)
        self.area.config(width=10, height=15)
        self.possible_options_text = StringVar()
        self.possible_options_text.set("Possible Options: ")
        self.possible_options_label = Label(self, textvariable=self.possible_options_text).grid(row=4, column=3,
                                                                                                sticky=N)

        huffman_coding_button = Button(self, text="Huffman",
                                       command=self.huffman_coding_callback).grid(row=5, column=0)
        arithmetic_coding_button = Button(self, text="Arithmetic Coding",
                                          command=self.arithmetic_coding_callback).grid(row=5, column=1)
        dictionary_coding_button = Button(self, text="Dictionary",
                                          command=self.dictionary_coding_callback).grid(row=5, column=2)
        elias_coding_button = Button(self, text="Elias",
                                     command=self.elias_coding_callback).grid(row=5, column=3)
        our_coding_button = Button(self, text="Elemental Coding",
                                   command=self.elemental_coding_callback).grid(row=5, column=4)
        self.pack()
        self.elemental_coding_callback()
开发者ID:JEpifanio90,项目名称:teoria_informacion,代码行数:55,代码来源:gui.py

示例11: initUI

 def initUI(self):
   
     self.parent.title("Sequence modification parser")          
     
     self.columnconfigure(0, pad=5)
     self.columnconfigure(1, pad=5, weight = 1)
     self.columnconfigure(2, pad=5)
     
     self.rowconfigure(0, pad=5, weight = 1)
     self.rowconfigure(1, pad=5, weight = 1)
     self.rowconfigure(2, pad=5, weight = 1)
     self.rowconfigure(3, pad=5, weight = 1)
     self.rowconfigure(4, pad=5, weight = 1)
     self.rowconfigure(5, pad=5, weight = 1)
     
     self.lInput = Label(self, text = "Input file")
     self.lInput.grid(row = 0, column = 0, sticky = W)
     self.lPRS = Label(self, text = "phospoRS Column Name")
     self.lPRS.grid(row = 1, column = 0, sticky = W)
     self.lScore = Label(self, text = "Min phosphoRS Score")
     self.lScore.grid(row = 2, column = 0, sticky = W)
     self.lDA = Label(self, text = "Check deamidation sites")
     self.lDA.grid(row = 3, column = 0, sticky = W)
     self.lLabFile = Label(self, text = "Label description file")
     self.lLabFile.grid(row = 4, column = 0, sticky = W)
     
     self.ifPathText = StringVar()
     self.prsScoreText = StringVar(value = '0')
     self.prsNameText = StringVar()
     self.doDAVar = IntVar()
     self.labFileText = StringVar(value = path.abspath('moddict.txt'))
     
     self.ifPath = Entry(self, textvariable = self.ifPathText)
     self.ifPath.grid(row = 0, column = 1, sticky = W+E)
     self.prsName = Entry(self, textvariable = self.prsNameText)
     self.prsName.grid(row = 1, column = 1, sticky = W+E)        
     self.prsScore = Entry(self, textvariable = self.prsScoreText, state = DISABLED)
     self.prsScore.grid(row = 2, column = 1, sticky = W+E)
     self.doDABox = Checkbutton(self, variable = self.doDAVar)
     self.doDABox.grid(row = 3, column = 1, sticky = W)
     self.labFile = Entry(self, textvariable = self.labFileText)
     self.labFile.grid(row = 4, column = 1, sticky = W+E)
     
     
     self.foButton = Button(self, text = "Select file", command = self.selectFileOpen)
     self.foButton.grid(row = 0, column = 2, sticky = E+W, padx = 3)
     self.prsButton = Button(self, text = "Select column", state = DISABLED, command = self.selectColumn)
     self.prsButton.grid(row = 1, column = 2, sticky = E+W, padx = 3)
     self.labFileButton = Button(self, text = "Select file", command = self.selectLabFileOpen)
     self.labFileButton.grid(row = 4, column = 2, sticky = E+W, padx = 3)
     self.startButton = Button(self, text = "Start", command = self.start, padx = 3, pady = 3)
     self.startButton.grid(row = 5, column = 1, sticky = E+W)
     
 
     self.pack(fill = BOTH, expand = True, padx = 5, pady = 5)
开发者ID:caetera,项目名称:AddModSeq,代码行数:55,代码来源:addModSeq.py

示例12: show

    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()
开发者ID:tylerjw,项目名称:jim_tracker,代码行数:53,代码来源:customer.py

示例13: __draw_new_draft_window

    def __draw_new_draft_window(self, parent):

        self.parent.title("New Draft")

        style = StringVar()
        style.set("Snake")

        opponent_label = Label(parent, text="Opponents")
        opponent_entry = Entry(parent, width=5)
        
        position_label = Label(parent, text="Draft Position")
        position_entry = Entry(parent, width=5)
        
        rounds_label = Label(parent, text="Number of Rounds")
        rounds_entry = Entry(parent, width=5)
        
        style_label = Label(parent, text="Draft Style")
        style_menu = OptionMenu(parent, style, "Snake", "Linear")
        
        def begin_draft():
            """
            initializes variables to control the flow of the draft
            calls the first window of the draft.
            """
            self.game.number_of_opponents = int(opponent_entry.get())
            self.game.draft_position = int(position_entry.get())
            self.game.number_of_rounds = int(rounds_entry.get())
            self.game.draft_style = style.get()
            
            self.game.opponents = []
            self.game.current_position = 1
            self.game.current_round = 1
            
            for x in xrange(self.game.number_of_opponents):
                self.game.opponents.append(Opponent.Opponent(x))

            if self.game.draft_position <= self.game.number_of_opponents + 1:
                MainUI(self.parent, self.game)
            else:
                tkMessageBox.showinfo("Error",
                                      "Draft position too high!\nYou would never get to pick a player"
                                      )

        def begin_button(event):
            begin_draft()

        ok_button = Button(parent, text="OK", command=begin_draft)
        self.parent.bind("<Return>", begin_button)
        
        opponent_label.grid(row=0, pady=5)
        opponent_entry.grid(row=0, column=1, pady=5)
        position_label.grid(row=1)
        position_entry.grid(row=1, column=1)
        rounds_label.grid(row=2, pady=5)
        rounds_entry.grid(row=2, column=1, pady=5, padx=5)
        style_label.grid(row=3)
        style_menu.grid(row=3, column=1)
        ok_button.grid(row=4, column=1, sticky="se", pady=5, padx=5)
开发者ID:BarnettMichael,项目名称:FantasyFootballHelper,代码行数:58,代码来源:FFHGui.py

示例14: initUI

 def initUI(self):
   
     self.parent.title("Review")
     self.pack(fill=BOTH, expand=True)
     
     frame1 = Frame(self)
     frame1.pack(fill=X)
     
     lbl1 = Label(frame1, text="Title", width=6)
     lbl1.pack(side=LEFT, padx=5, pady=5)           
    
     entry1 = Entry(frame1)
     entry1.pack(fill=X, padx=5, expand=True)
开发者ID:Pedro-M-Santos,项目名称:python_scripts,代码行数:13,代码来源:gui_v2.py

示例15: initUI

	def initUI(self, parameterDict, callback, validate, undoCallback):

		self.parent.title("Choose parameters for fit")

		Style().configure("TButton", padding=(0, 5, 0, 5), 
			font='serif 10')

		self.columnconfigure(0, pad=3)
		self.columnconfigure(1, pad=3)

		count = 0
		entries = {}
		for key, value in parameterDict.iteritems():
			self.rowconfigure(count, pad=3)
			label = Label(self, text=key)
			label.grid(row=count, column=0)
			entry = Entry(self)
			entry.grid(row=count, column=1)
			entry.insert(0, value)
			entries[key] = entry
			count = count + 1

		def buttonCallback(*args): #the *args here is needed because the Button needs a function without an argument and the callback for function takes an event as argument
			try:
				newParameterDict = {}
				for key, value in entries.iteritems():
					newParameterDict[key] = value.get()
				self.parent.withdraw() #hide window
				feedback = callback(newParameterDict)
				if validate:
					if(askyesno("Validate", feedback,  default=YES)):
						self.parent.destroy() #clean up window
					else:
						undoCallback() #rollback changes done by callback
						self.parent.deiconify() #show the window again
				else:
					self.parent.withdraw()
					self.parent.destroy()
			except Exception as e:
				import traceback
				traceback.print_exc()
				self.parent.destroy()

		self.parent.bind("<Return>", buttonCallback)
		self.parent.bind("<KP_Enter>", buttonCallback)
		run = Button(self, text="Run fit", command=buttonCallback)
		run.grid(row=count, column=0)
		count = count + 1
		self.pack()
开发者ID:kkelly44,项目名称:nmt,代码行数:49,代码来源:startingvaluesdialog.py


注:本文中的ttk.Entry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。