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


Python IntVar.set方法代码示例

本文整理汇总了Python中tkinter.IntVar.set方法的典型用法代码示例。如果您正苦于以下问题:Python IntVar.set方法的具体用法?Python IntVar.set怎么用?Python IntVar.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.IntVar的用法示例。


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

示例1: DlgLogin

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class DlgLogin(Dialog):
    def body(self, master, cfg={}):
        "place user dialog widgets"
        self.config = cfg
        self.config["OK button"] = False
        self.site = StringVar()
        self.site.set(cfg.get("site", ""))
        self.login = StringVar()
        self.login.set(cfg.get("user", ""))
        self.password = StringVar()
        self.password.set(str(cfg.get("password", "")))
        site = Entry(master, width=15, textvariable=self.site)
        site.grid(column=1, row=0, sticky="e")
        Label(master, text=_("Site:")).grid(column=0, row=0, sticky="w")
        loge = Entry(master, width=15, textvariable=self.login)
        loge.grid(column=1, row=1, sticky="e")
        Label(master, text=_("Username:")).grid(column=0, row=1, sticky="w")
        pase = Entry(master, width=15, textvariable=self.password, show="*")
        pase.grid(column=1, row=2, sticky="e")
        Label(master, text=_("Password:")).grid(column=0, row=2, sticky="w")
        self.to_remember = IntVar()
        self.to_remember.set(cfg.get("remember_passwd", 1))
        chk1 = Checkbutton(master, text="Remember",
                           variable=self.to_remember)
        chk1.grid(column=0, row=3, sticky="w", columnspan=2)
        self.resizable(width=0, height=0)
        return loge

    def apply(self):
        "On ok button pressed"
        self.config["remember_passwd"] = self.to_remember.get()
        self.config["site"] = self.site.get()
        self.config["user"] = self.login.get()
        self.config["password"].set_password(self.password.get())
        self.config["OK button"] = True
开发者ID:Lysovenko,项目名称:OTRS_US,代码行数:37,代码来源:dialogs.py

示例2: NetworkPage

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class NetworkPage(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.generalnavframe = ttk.Frame(self)
        self.generalnavframe.grid(row=0, column=0, sticky="nsew")

        self.generalpagebutt = tk.Button(self.generalnavframe, text="General", width=10, height=3, command=lambda: controller.show_frame(GeneralPage))
        self.generalpagebutt.grid(row=0, column=0)

        self.filesyspagebutt = tk.Button(self.generalnavframe, text="File System", width=10, height=3, command=lambda: controller.show_frame(FileSYSPage))
        self.filesyspagebutt.grid(row=0, column=1)

        self.serialpagebutt = tk.Button(self.generalnavframe, text="Serial", width=10, height=3, command=lambda: controller.show_frame(SerialPage))
        self.serialpagebutt.grid(row=0, column=2)

        self.networkpagebutt = tk.Button(self.generalnavframe, text="Network", width=10, height=3, bg='gray', command=lambda: controller.show_frame(NetworkPage))
        self.networkpagebutt.grid(row=0, column=3)

        self.generalcontrollsframe = ttk.Frame(self)  # secondary frame with page controlls
        self.generalcontrollsframe.grid(row=1, column=0, sticky="nsew")

        self.var = IntVar()
        self.var.set(2)

        self.dhcp = ttk.Radiobutton(self.generalcontrollsframe, text="Dhcp", variable=self.var, value=2)
        self.dhcp.grid(row=0, column=1)

        self.static = ttk.Radiobutton(self.generalcontrollsframe, text="Static", variable=self.var, value=1)
        self.static.grid(row=0, column=0)

        self.ipaddress = ttk.Label(self.generalcontrollsframe, text="Ip Address")
        self.ipaddress.grid(row=1, column=0)
        self.ipaddrv4 = ttk.Entry(self.generalcontrollsframe, width=16)
        self.ipaddrv4.grid(row=1, column=1)

        self.subnetlbl = ttk.Label(self.generalcontrollsframe, text="Subnet")
        self.subnetlbl.grid(row=2, column=0)
        self.subnet = ttk.Entry(self.generalcontrollsframe, width=16)
        self.subnet.grid(row=2, column=1)

        self.gatewaylbl = ttk.Label(self.generalcontrollsframe, text="Gateway")
        self.gatewaylbl.grid(row=3, column=0)
        self.gateway = ttk.Entry(self.generalcontrollsframe, width=16)
        self.gateway.grid(row=3, column=1)

        self.dns1lbl = ttk.Label(self.generalcontrollsframe, text="Dns1")
        self.dns1lbl.grid(row=4, column=0)
        self.dns1 = ttk.Entry(self.generalcontrollsframe, width=16)
        self.dns1.grid(row=4, column=1)

        self.dns2lbl = ttk.Label(self.generalcontrollsframe, text="Dns2")
        self.dns2lbl.grid(row=5, column=0)
        self.dns2 = ttk.Entry(self.generalcontrollsframe, width=16)
        self.dns2.grid(row=5, column=1)

        self.setnetwork = ttk.Button(self.generalcontrollsframe, text="Set", width=16)
        self.setnetwork.grid(row=7, column=0, columnspan=2)
开发者ID:techead1982,项目名称:Gbrl-Rpi-gcode-DCLaser-Sender,代码行数:60,代码来源:laserUI_beta2.py

示例3: FrameKSPObject

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class FrameKSPObject(Frame):
    
    
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        frame = Frame(self)
        frame.pack()
        self.string_var0 = StringVar()
        self.string_var1 = StringVar()
        self.int_var = IntVar()
        self.entry0 = Entry(frame, textvariable=self.string_var0)
        self.entry0.pack(side='left')
        Entry(frame, textvariable=self.string_var1).pack(side='left')
        frame = Frame(self)
        frame.pack()
        Button(frame, width=8, text='Accept', command=self.accept).pack(side='left')
        Button(frame, width=8, text='Cancel', command=self.cancel).pack(side='left')
        Button(frame, width=8, text='Delete', command=self.delete).pack(side='left')
        
        
    def populate(self, kspobject):
        self._kspobject = kspobject
        self.string_var0.set(kspobject.name)
        self.string_var1.set(kspobject.value)
        self.int_var.set(kspobject.id_)
        
        
    def accept(self):
        name = self.string_var0.get()
        value = self.string_var1.get()
        id_ = self.int_var.get()
        self.master.master.update_kspobject(name, value, id_)
        self.master.destroy()
    
    
    def cancel(self):
        self.master.destroy()
    
    
    def delete(self):
        id_ = self.int_var.get()
        self.master.master.delete_kspobject(id_)
        self.master.destroy()
        
        
        
        
        
        
        
        
        
        
        
        
        
开发者ID:dan2082,项目名称:KSPData,代码行数:46,代码来源:frame_kspobject.py

示例4: DiceTab

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class DiceTab(Frame):
    def __init__(self,master=None):
        Frame.__init__(self,master)
        #Sides of Dice
        labelSides=Label(self,text="Sides")
        labelSides.grid(row=0,column=0)
        self.sides=StringVar()
        self.sides.set(20)
        spinboxSides=Spinbox(self,from_=1,to=20,increment=1,width=4)
        spinboxSides.config(textvariable=self.sides, font="sans 24", justify="center")
        spinboxSides.grid(row=0,column=1)
        #Number of Dices
        labelNumber=Label(self,text="Number")
        labelNumber.grid(row=1,column=0)
        self.number=StringVar()
        self.number.set(1)
        spinboxNumber=Spinbox(self,from_=1,to=30,increment=1,width=4)
        spinboxNumber.config(textvariable=self.number, font="sans 24", justify="center")
        spinboxNumber.grid(row=1,column=1)
        #Modifier
        labelModifier=Label(self,text="Modifier")
        labelModifier.grid(row=2,column=0)
        self.modifier=StringVar()
        self.modifier.set(0)
        spinboxModifier=Spinbox(self,from_=-5,to=5,increment=1,width=4)
        spinboxModifier.config(textvariable=self.modifier, font="sans 24", justify="center")
        spinboxModifier.grid(row=2,column=1)
        #Hide Checkbox
        labelHide=Label(self, text="Hide")
        labelHide.grid(row=2, column=2)
        self.hide=IntVar()
        self.hide.set(0)
        checkbuttonHide=Checkbutton(self,variable=self.hide)
        checkbuttonHide.grid(row=2,column=3)
        #Result display
        self.result=StringVar()
        self.result.set("")
        labelResult1=Label(self,text="Result")
        labelResult1.grid(row=1, column=4)
        labelResult2=Label(self,text=self.result.get(),relief=SUNKEN,width=4)
        labelResult2.grid(row=1,column=5)
        #Button to roll
        buttonRoll=Button(self,text="Roll!", command=self.roll)
        buttonRoll.grid(row=2,column=5)
        

    def roll(self):
        self.throws=[]
        numberOfDices=int(self.number.get())
        sidesOfDice=int(self.sides.get())
        modifierOfDice=int(self.modifier.get())
        
        for i in range(numberOfDices):
            self.throws.append(rd.randint(1,sidesOfDice))
        self.result.set(str(sum(self.throws)+modifierOfDice))
        labelResult2=Label(self,text=self.result.get(),relief=SUNKEN, width=4)
        labelResult2.grid(row=1,column=5)
开发者ID:jkesselring,项目名称:DnDApp,代码行数:59,代码来源:dice.py

示例5: __init__

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class Calculator:
    def __init__(self, master):
        self.master = master
        master.title("Calculator")

        self.total = 0
        self.entered_number = 0

        self.total_label_text = IntVar()
        self.total_label_text.set(self.total)
        self.total_label = Label(master, textvariable=self.total_label_text)

        self.label = Label(master, text="Total:")

        vcmd = master.register(self.validate)  # we have to wrap the command
        self.entry = Entry(master, validate="key", validatecommand=(vcmd, "%P"))

        self.add_button = Button(master, text="+", command=lambda: self.update("add"))
        self.subtract_button = Button(master, text="-", command=lambda: self.update("subtract"))
        self.multiply_button = Button(master, text="*", command=lambda: self.update("multiply"))
        # self.divide_button = Button(master, text="/", command=lambda: self.update("divide"))
        self.reset_button = Button(master, text="Reset", command=lambda: self.update("reset"))

        # LAYOUT
        self.label.grid(row=0, column=0, sticky=W)
        self.total_label.grid(row=0, column=1, columnspan=2, sticky=E)
        self.entry.grid(row=1, column=0, columnspan=5, sticky=W + E)
        self.add_button.grid(row=2, column=0)
        self.subtract_button.grid(row=2, column=1)
        self.multiply_button.grid(row=2, column=2)
        # self.divide_button.grid(row=2, column=3)
        self.reset_button.grid(row=2, column=4, sticky=W + E)

    def validate(self, new_text):
        if not new_text:  # the field is being cleared
            self.entered_number = 0
        return True

        try:
            self.entered_number = int(new_text)
            return True
        except ValueError:
            return False

    def update(self, method):
        if method == "add":
            self.total += self.entered_number
        elif method == "subtract":
            self.total -= self.entered_number
        elif method == "multiply":
            self.total *= self.entered_number
        elif method == "divide":
            self.total /= self.entered_number
        else:  # reset
            self.total = 0
        self.total_label_text.set(self.total)
        self.entry.delete(0, END)
开发者ID:anwittin,项目名称:Python,代码行数:59,代码来源:calc.py

示例6: Checkbox

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class Checkbox(Checkbutton):
    def __init__(self, master, text, default=None, **args):
        self.var = IntVar()
        Checkbutton.__init__(self, master, text=text, variable=self.var, **args)
        if default is not None:
            self.var.set(default)

    def get(self):
        return self.var.get()
开发者ID:bbferka,项目名称:pracmln,代码行数:11,代码来源:widgets.py

示例7: ProgressCheckButton

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class ProgressCheckButton(Frame, Observable):
    def __init__(self, parent, model, index, status_model):
        Frame.__init__(self, parent)
        Observable.__init__(self)
        self.model = model
        self.index = index
        self.status_model = status_model
        self.var = IntVar()
        self.var.set(model.get_checked())
        self.progress_var = IntVar()
        self.progress_status = ProgressStatus.undefined
        self.check_button = Checkbutton(self, text=model.get_label, variable=self.var, command=self._check_changed)
        self.progress_bar = Progressbar(self, orient='horizontal', mode='indeterminate', variable=self.progress_var)
        self.check_button.pack(side=LEFT, fill="both", expand=True)

        self.model.add_listener(self._model_changed)

    def _model_changed(self, new_status):
        model_state = self.model.get_checked()
        gui_state = self.var.get()
        if model_state is not gui_state:
            self.model.set_checked(gui_state)

    def refresh_check(self):
        if self.status_model.is_checked_force_reload():
            self.check_button.select()
        else:
            self.check_button.deselect()

    def is_checked(self):
        return self.var.get()

    def _progress_status_changed(self, new_status):
        self._refresh_progress()

    def _refresh_progress(self):
        status = self.status_model.get_status()
        if not status == self.progress_status:
            if status == ProgressStatus.in_progress:
                self.progress_bar.pack(side=RIGHT, fill="both", expand=True)
            else:
                self.progress_bar.pack_forget()

    def _check_changed(self):
        new_checked = self.var.get()
        if new_checked is not self.model.get_checked():
            self.model.set_checked(new_checked)
        if new_checked is not self.status_model.is_checked():
            self._notify(self.index, new_checked)
开发者ID:tomdoel,项目名称:pyxnatbrowser,代码行数:51,代码来源:progresslistbox.py

示例8: ProgressListBoxItem

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class ProgressListBoxItem(Frame, Observable):
    def __init__(self, parent, model):
        Frame.__init__(self, parent)
        Observable.__init__(self)
        self._model = model

        # Create variables and initialise to zero
        self._checked_var = IntVar()
        self._progress_var = IntVar()
        self._checked_var.set(0)
        self._progress_var.set(0)
        self._current_gui_checked_state = CheckStatus.undefined
        self._current_gui_progress_state = ProgressStatus.undefined

        self.check_button = Checkbutton(self, text=model.get_label(), variable=self._checked_var, command=self._user_check_changed)
        self.progress_bar = Progressbar(self, orient='horizontal', mode='indeterminate', variable=self._progress_var)
        self.check_button.pack(side=LEFT, fill="both", expand=True)

        self._update()
        self._model.add_listener(self._model_changed)

    def _model_changed(self):
        self.update()

    def _update(self):
        # Update check status
        model_check_state = self._model.get_check_status()
        if model_check_state is not self._current_gui_checked_state:
            self._current_gui_checked_state = model_check_state
            # if self.status_model.is_checked_force_reload():
            if model_check_state:
                self.check_button.select()
            else:
                self.check_button.deselect()

        # Update progress status
        model_progress_state = self._model.get_progress_status
        if not model_progress_state == self._current_gui_progress_state:
            self._current_gui_progress_state = model_progress_state
            if model_progress_state == ProgressStatus.in_progress:
                self.progress_bar.pack(side=RIGHT, fill="both", expand=True)
            else:
                self.progress_bar.pack_forget()

    def _user_check_changed(self):
        new_checked = self._checked_var.get()
        if new_checked is not self._model.get_check_status():
            self._model.manual_set_checked(new_checked)
开发者ID:tomdoel,项目名称:pyxnatbrowser,代码行数:50,代码来源:progresslistbox.py

示例9: Options

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class Options(Frame):
    def __init__(self, master, ordinances=False, **kwargs):
        super(Options, self).__init__(master, **kwargs)
        self.ancestors = IntVar()
        self.ancestors.set(4)
        self.descendants = IntVar()
        self.spouses = IntVar()
        self.ordinances = IntVar()
        self.contributors = IntVar()
        self.start_indis = StartIndis(self)
        self.fid = StringVar()
        btn = Frame(self)
        entry_fid = EntryWithMenu(btn, textvariable=self.fid, width=16)
        entry_fid.bind('<Key>', self.enter)
        label_ancestors = Label(self, text=_('Number of generations to ascend'))
        entry_ancestors = EntryWithMenu(self, textvariable=self.ancestors, width=5)
        label_descendants = Label(self, text=_('Number of generations to descend'))
        entry_descendants = EntryWithMenu(self, textvariable=self.descendants, width=5)
        btn_add_indi = Button(btn, text=_('Add a FamilySearch ID'), command=self.add_indi)
        btn_spouses = Checkbutton(self, text='\t' + _('Add spouses and couples information'), variable=self.spouses)
        btn_ordinances = Checkbutton(self, text='\t' + _('Add Temple information'), variable=self.ordinances)
        btn_contributors = Checkbutton(self, text='\t' + _('Add list of contributors in notes'), variable=self.contributors)
        self.start_indis.grid(row=0, column=0, columnspan=3)
        entry_fid.grid(row=0, column=0, sticky='w')
        btn_add_indi.grid(row=0, column=1, sticky='w')
        btn.grid(row=1, column=0, columnspan=2, sticky='w')
        entry_ancestors.grid(row=2, column=0, sticky='w')
        label_ancestors.grid(row=2, column=1, sticky='w')
        entry_descendants.grid(row=3, column=0, sticky='w')
        label_descendants.grid(row=3, column=1, sticky='w')
        btn_spouses.grid(row=4, column=0, columnspan=2, sticky='w')
        if ordinances:
            btn_ordinances.grid(row=5, column=0, columnspan=3, sticky='w')
        btn_contributors.grid(row=6, column=0, columnspan=3, sticky='w')
        entry_ancestors.focus_set()

    def add_indi(self):
        if self.start_indis.add_indi(self.fid.get()):
            self.fid.set('')

    def enter(self, evt):
        if evt.keysym in {'Return', 'KP_Enter'}:
            self.add_indi()
开发者ID:daleathan,项目名称:getmyancestors,代码行数:45,代码来源:fstogedcom.py

示例10: __init__

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class VariableLabel:
    def __init__(self,parent,col,row,genre):

        """

        :param parent: fenetre root
        :param col: colonne pour placer le label
        :param row: ligne pour placer le label
        :param genre: type de label (int ou str)
        """
        self.val=StringVar()
        self.val.set("RED")
        if (genre=="integer"):
            self.val=IntVar()
            self.val.set(0)
        label=Label(parent,textvariable=self.val,bg="bisque")
        label.grid(column=col,row=row)

    def getVar(self):
        return(self.val)

    def setVar(self,valeur):
        """

        :param valeur: nouvelle valeur du Label
        """
        self.val.set(valeur)
开发者ID:malikfassi,项目名称:draughts,代码行数:29,代码来源:draughtsGUI.py

示例11: Status_Bar

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class Status_Bar(Frame):
    """
    The status bar visualizes progress and status.
    """
    task = None

    def __init__(self, _master):
        super(Status_Bar, self).__init__(_master, bd=1, relief=SUNKEN)

        self.task = StringVar()
        self.progress = IntVar()
        self.init_widgets()

    def update_task(self, _task, _progress):
        """ This function is used as an endpoint for for the
        bubbling notify_task call of the BPMFrame class.
        :param _task: Text that defines the task
        :param _progress: Text that describes the degree of progress
        """
        if _progress < 0:
            self.pb_progress.mode = 'indeterminate'
        else:
            self.pb_progress.mode = 'determinate'

        self.task.set(_task)
        self.progress.set(_progress)
        self.update_idletasks()

    def init_widgets(self):
        """
        Initialize visual elements.
        """

        self.l_task = ttk.Label(self, textvariable=self.task, width=70)
        self.l_task.pack(side=LEFT, fill=X)

        self.pb_progress = ttk.Progressbar(self, variable=self.progress, length=150)
        self.pb_progress.pack(side=RIGHT)
开发者ID:OptimalBPM,项目名称:qal,代码行数:40,代码来源:widgets_misc.py

示例12: _create_frame_with_radio_btns

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
    def _create_frame_with_radio_btns(self, parent, name, text, row_index,
                                      column_index, add_both=True):
        ''' Creates frame with one set of Radiobuttons.

            Args:
                parent (Tk object): parent of the frame.
                name (str): name of the parameter that will a key in options
                    dictionary.
                text (list of str): list with two parameter values that should
                    be displayed next to the first two Radiobuttons.
                row_index (int): index of the row where the frame should
                    be placed using grid method.
                column_index (int): index of the column where the frame
                    should be placed using grid method.
                add_both (bool, optional): True if the third Radiobutton
                    with text "both" must be displayed, False otherwise,
                    defaults to True.
        '''
        assert len(text) == 2
        v = IntVar()
        self.options[name] = v
        self.options[name].trace(
            'w', (lambda *args: self.radio_btn_change(name)))
        frame_with_radio_btns = Frame(parent)
        first_option = Radiobutton(frame_with_radio_btns,
                                   text=text[0], variable=v, value=1)
        first_option.grid(row=0, column=0, sticky=W+N, padx=2)
        v.set(1)
        second_option = Radiobutton(frame_with_radio_btns,
                                    text=text[1], variable=v, value=2)
        second_option.grid(row=1, column=0, sticky=W+N, padx=2)
        if add_both:
            both = Radiobutton(frame_with_radio_btns, text='Both',
                               variable=v, value=3)
            both.grid(row=3, column=0, sticky=W+N, padx=2)
        frame_with_radio_btns.grid(row=row_index, column=column_index,
                                   padx=1, pady=5, sticky=W+N)
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:39,代码来源:options_frame_gui.py

示例13: MainMenu

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class MainMenu():
    def main(self):
        '''Function to run on game start'''
        self.mainMenu=Tk()
        self.mainMenu.geometry('200x300+200+200')
        self.mainMenu.title("Minesweeper")
        playButton=Button(self.mainMenu,text='Play',command=lambda:self.startPlay(None))

        self.height= IntVar()
        self.width= IntVar()
        self.minesAmount= IntVar()

        self.height.set(10)
        self.width.set(10)
        self.minesAmount.set(10)

        playButton.pack()
        
        xSlider=Scale(self.mainMenu,orient='horizontal',length=150,width=15,label='Height',sliderlength=20,from_=1,to=15,tickinterval=0,variable=self.height).pack()
        ySlider=Scale(self.mainMenu,orient='horizontal',length=150,width=15,label='Width',sliderlength=20,from_=1,to=15,tickinterval=0,variable=self.width).pack()      
        minesSlider=Scale(self.mainMenu,orient='horizontal',length=150,width=15,label='Mines',sliderlength=20,from_=0,to=15*15-1,tickinterval=0,variable=self.minesAmount).pack()
        
        aboutButton=Button(self.mainMenu,text='About',command=self.about)
        quitButton=Button(self.mainMenu,text='Quit',command=self.quitApp)

        
        
        aboutButton.pack()
        quitButton.pack()

    def startPlay(self,event):
        play=Play()
        minesAmount=self.minesAmount.get()
        height=self.height.get()
        width=self.width.get()
        if minesAmount>width*height-1:
            messagebox.showerror(title='Error',message="Amount of mines can't be bigger than total size of the field. Plese try again.")
            return
        self.mainMenu.destroy()
        play.StartGame(minesAmount,height,width)

    def about(self):
        messagebox.showinfo(title='About',message='Author:Marcel Salmič.')
        
    def quitApp(self):
        self.mainMenu.destroy()
开发者ID:kodmarcel,项目名称:Minesweeper,代码行数:48,代码来源:Main.py

示例14: EnaSubOptionsForm

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]
class EnaSubOptionsForm(VerticalScrolledFrame):
        
    # Initialize the GUI
    def __init__(self, root):
        
        #Frame.__init__(self, root)
        VerticalScrolledFrame.__init__(self, root)
        
        root.title("Choose EMBL-ENA Submission Options")
        self.parent = root
        
        # Assign the icon of this sub-window.
        assignIcon(self.parent)

        #button_opt = {'fill': Tkconstants.BOTH, 'padx': 35, 'pady': 5}
        
        # To define the exit behavior.  Save and exit.
        self.parent.protocol('WM_DELETE_WINDOW', self.saveOptions)
        
        # Define the return behavior.  Same as "close window" etc
        root.bind('<Return>', self.returnFunction)
  
        # This window should not be resizeable. I guess.
        self.parent.resizable(width=False, height=False)
        
        #Standard Inputs widths for the form elements
        formInputWidth = 30
        labelInputWidth = 30
        
        self.instructionsFrame = Frame(self.interior)  
        self.instructionText = StringVar()       
        self.instructionText.set('\nProvide this required sequence metadata, please.\n' 
                + 'The Allele Local Name is provided by the submitting laboratory.\n'
                + 'You may name it similar to the closest known allele,\n'
                + 'if you wish.')        
        Label(self.instructionsFrame, width=85, height=6, textvariable=self.instructionText).pack()
        self.instructionsFrame.pack()
        
        self.submissionDetailsInputFrame2 = Frame(self.interior)
  
        self.sampleIDInstrText = StringVar()
        self.sampleIDInstrText.set('Sample ID:')
        self.sampleIDinstrLabel = Label(self.submissionDetailsInputFrame2, width=labelInputWidth, height=1, textvariable=self.sampleIDInstrText).grid(row=0, column=0)
        self.inputSampleID = StringVar()
        self.inputSampleIDEntry = Entry(self.submissionDetailsInputFrame2, width=formInputWidth, textvariable=self.inputSampleID).grid(row=0, column=1)

        self.geneInstrStringVar = StringVar()
        self.geneInstrStringVar.set('Gene:')
        self.geneInstrLabel = Label(self.submissionDetailsInputFrame2, width=labelInputWidth, height=1, textvariable=self.geneInstrStringVar).grid(row=1, column=0)
        self.inputGene = StringVar()        
        self.inputGeneEntry = Entry(self.submissionDetailsInputFrame2, width=formInputWidth, textvariable=self.inputGene).grid(row=1, column=1)

        self.chooseClassIntVar = IntVar()
        self.chooseClassIntVar.set(1)
        Radiobutton(self.submissionDetailsInputFrame2, text="HLA Class I ", variable=self.chooseClassIntVar, value=1).grid(row=2, column=0)
        Radiobutton(self.submissionDetailsInputFrame2, text="HLA Class II", variable=self.chooseClassIntVar, value=2).grid(row=2, column=1)

        self.alleleInstrText = StringVar()
        self.alleleInstrText.set('Allele Local Name:')
        self.alleleInstrLabel = Label(self.submissionDetailsInputFrame2, width=labelInputWidth, height=1, textvariable=self.alleleInstrText).grid(row=3, column=0)
        self.inputAllele = StringVar() 
        self.inputAlleleEntry = Entry(self.submissionDetailsInputFrame2, width=formInputWidth, textvariable=self.inputAllele).grid(row=3, column=1)

        self.submissionDetailsInputFrame2.pack()
                
                
        # Make a frame to contain the Test/Production radio buttons.
        self.testProductionFrame = Frame(self.interior)
        
        self.testProductionInstrText = StringVar()
        self.testProductionInstrText.set('\nBy default, you submit to the EMBL-ENA test servers,\n'
            + 'where submissions are regularly deleted.\n'
            + 'change this option if you want to submit to the live environment.\n'
            + 'Login Credentials will not be stored, but they will be sent\n'
            + 'to EMBL-ENA via REST during allele submission.\n'
            )
        self.alleleInstrLabel = Label(self.testProductionFrame, width=70, height=7, textvariable=self.testProductionInstrText).pack()#.grid(row=2, column=0)
 
        # 1 = Test.  0 = Production/live server
        self.chooseTestServersIntVar = IntVar()
        # a short check in case the config value has not been implemented yet.
        if(getConfigurationValue('test_submission') is not None):        
            self.chooseTestServersIntVar.set(int(getConfigurationValue('test_submission')))
        else:
            self.chooseTestServersIntVar.set(1)
 
        Radiobutton(self.testProductionFrame, text="Submit to EMBL-ENA TEST / DEMO environment.", variable=self.chooseTestServersIntVar, value=1).pack()
        Radiobutton(self.testProductionFrame, text="Submit to EMBL-ENA LIVE / PROD environment.", variable=self.chooseTestServersIntVar, value=0).pack()
        
        self.testProductionFrame.pack()
     
        # Make a frame to contain the input variables
        self.submissionDetailsInputFrame = Frame(self.interior)

        self.usernameInstrText = StringVar()
        self.usernameInstrText.set('EMBL-ENA Username:')
        self.usernameInstrLabel = Label(self.submissionDetailsInputFrame, width=labelInputWidth, height=1, textvariable=self.usernameInstrText).grid(row=0, column=0)
        self.inputUsername = StringVar()
        self.inputUsernameEntry = Entry(self.submissionDetailsInputFrame, width=formInputWidth, textvariable=self.inputUsername).grid(row=0, column=1)

#.........这里部分代码省略.........
开发者ID:bmatern,项目名称:EMBL-HLA-Submission,代码行数:103,代码来源:EnaSubOptionsForm.py

示例15: PypeTkPad

# 需要导入模块: from tkinter import IntVar [as 别名]
# 或者: from tkinter.IntVar import set [as 别名]

#.........这里部分代码省略.........
                #   1) is a class defined within the script
                #   2) the class is a subclass of pypes.pypescript
                scriptObjectClasses = [x for x in dir(module) if isclass(getattr(module, x)) and issubclass(getattr(module, x), pypes.pypeScript)]
                scriptObjectClassName = scriptObjectClasses[0]
                scriptObject = getattr(module, scriptObjectClassName)
                scriptObject = scriptObject()
                members = scriptObject.InputMembers + scriptObject.OutputMembers
                for member in members:
                    optionlist.append('-'+member.OptionName)
                list = [option for option in optionlist if option.count(word)]
            except:
                return list
        else:
            list = [scriptname for scriptname in vmtkscripts.__all__ if scriptname.count(word)]
            for index, item in enumerate(list):
                # check if scriptname contains starting prefix 'vmtk.' and remove it before returning list to the user.
                if 'vmtk.' == item[0:5]:
                    splitList = item.split('.')
                    list[index] = splitList[1]
                else:
                    continue
        return list

    def FillSuggestionsList(self,word):
        from tkinter import END
        self.suggestionslist.delete(0,END)
        suggestions = self.GetSuggestionsList(word)
        for suggestion in suggestions:
            self.suggestionslist.insert(END,suggestion)

    def ReplaceTextCommand(self,word):
        self.text_input.delete(self.wordIndex[0],self.wordIndex[1])
        self.text_input.insert(self.wordIndex[0],word)
        self.text_input.focus_set()

    def ShowHelpCommand(self):
        word = self.GetWordUnderCursor()
        self.OutputText(word)
        if word:
            self.RunPype(word+' --help')
        else: 
            self.OutputText('Enter your vmtk Pype above and Run.\n')

    def AutoCompleteCommand(self):
        word = self.GetWordIndex()
        self.suggestionswindow.withdraw()
        if word:
            self.FillSuggestionsList(word)
            self.suggestionswindow.geometry("%dx%d%+d%+d" % (400, 150, self.text_output.winfo_rootx(),self.text_output.winfo_rooty()))
            self.suggestionswindow.deiconify()
            self.suggestionswindow.lift()
            
    def InsertScriptName(self,scriptname):
        from tkinter import INSERT
        self.text_input.insert(INSERT,scriptname+' ')
        
    def InsertFileName(self):
        from tkinter import INSERT
        import tkinter.filedialog
        openfilename = tkinter.filedialog.askopenfilename()
        if not openfilename:
            return
        if len(openfilename.split()) > 1:
            openfilename = '"%s"' % openfilename
        self.text_input.insert(INSERT,openfilename+' ')
开发者ID:samsmu,项目名称:vmtk,代码行数:69,代码来源:pypepad.py


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