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


Python Checkbutton.select方法代码示例

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


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

示例1: create_other_buttons

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
    def create_other_buttons(self):
        f = self.make_frame()[0]

        btn = Checkbutton(f, anchor="w",
                variable=self.recvar,
                text="Recurse down subdirectories")
        btn.pack(side="top", fill="both")
        btn.select()
开发者ID:belzner,项目名称:idle-errors-uap,代码行数:10,代码来源:GrepDialog.py

示例2: initUI

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
    def initUI(self):

        self.parent.title("Checkbutton")

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

        cb = Checkbutton(self, text="Show title", variable=self.var, command=self.onClick)
        cb.select()
        cb.place(x=50, y=50)
开发者ID:hangyeolkim91,项目名称:python3_document,代码行数:12,代码来源:example_tk_4_checkbox.py

示例3: create_option_buttons

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
    def create_option_buttons(self):
        "Fill frame with Checkbuttons bound to SearchEngine booleanvars."
        f = self.make_frame("Options")

        btn = Checkbutton(f, anchor="w",
                variable=self.engine.revar,
                text="Regular expression")
        btn.pack(side="left", fill="both")
        if self.engine.isre():
            btn.select()

        btn = Checkbutton(f, anchor="w",
                variable=self.engine.casevar,
                text="Match case")
        btn.pack(side="left", fill="both")
        if self.engine.iscase():
            btn.select()

        btn = Checkbutton(f, anchor="w",
                variable=self.engine.wordvar,
                text="Whole word")
        btn.pack(side="left", fill="both")
        if self.engine.isword():
            btn.select()

        if self.needwrapbutton:
            btn = Checkbutton(f, anchor="w",
                    variable=self.engine.wrapvar,
                    text="Wrap around")
            btn.pack(side="left", fill="both")
            if self.engine.iswrap():
                btn.select()
开发者ID:vemulasravan6,项目名称:cpython,代码行数:34,代码来源:SearchDialogBase.py

示例4: ProgressCheckButton

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [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

示例5: create_option_buttons

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
 def create_option_buttons(self):
     "Fill frame with Checkbuttons bound to SearchEngine booleanvars."
     frame = self.make_frame("Options")[0]
     engine = self.engine
     options = [(engine.revar, "Regular expression"),
                (engine.casevar, "Match case"),
                (engine.wordvar, "Whole word")]
     if self.needwrapbutton:
         options.append((engine.wrapvar, "Wrap around"))
     for var, label in options:
         btn = Checkbutton(frame, anchor="w", variable=var, text=label)
         btn.pack(side="left", fill="both")
         if var.get():
             btn.select()
     return frame, options  # for test
开发者ID:google,项目名称:cpython-pt,代码行数:17,代码来源:SearchDialogBase.py

示例6: ProgressListBoxItem

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [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

示例7: create_option_buttons

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
    def create_option_buttons(self):
        """Return (filled frame, options) for testing.

        Options is a list of SearchEngine booleanvar, label pairs.
        A gridded frame from make_frame is filled with a Checkbutton
        for each pair, bound to the var, with the corresponding label.
        """
        frame = self.make_frame("Options")[0]
        engine = self.engine
        options = [(engine.revar, "Regular expression"), (engine.casevar, "Match case"), (engine.wordvar, "Whole word")]
        if self.needwrapbutton:
            options.append((engine.wrapvar, "Wrap around"))
        for var, label in options:
            btn = Checkbutton(frame, anchor="w", variable=var, text=label)
            btn.pack(side="left", fill="both")
            if var.get():
                btn.select()
        return frame, options
开发者ID:alexandremetgy,项目名称:MrPython,代码行数:20,代码来源:SearchDialogBase.py

示例8: _makesetting

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
def _makesetting(setting_window, conf):
    setting_label = Label(setting_window,
                          text=_('Setting'),
                          font=('courier', 20, 'bold'))
    setting_label.pack(side=TOP)

    style_container = Frame(setting_window)
    style_container.pack(side=TOP)
    style_label = Label(style_container,
                        text=_('Display wallpaper in style: '),
                        font=('courier', 15, 'bold'))
    style_label.pack(side=LEFT)
    style_combobox = Combobox(style_container)
    available_style = {'3': 'zoom', '2': 'scaled', '1': 'stretched', '0': 'centered', '4': 'wallpaper'}
    style_combobox['value'] = (_('centered'), _('stretched'), _('scaled'), _('zoom'), _('wallpaper'))
    style_combobox.state(['readonly'])
    style_combobox.current(int(conf['style']))
    style_combobox.pack(side=LEFT)

    random_container = Frame(setting_window)
    random_container.pack(side=TOP)
    random_label = Label(random_container,
                         text=_('Choose wallpaper randomly? '),
                         font=('courier', 15, 'bold'))
    random_label.pack(side=LEFT)
    random_checkbutton = Checkbutton(random_container)
    random_checkbutton.pack(side=LEFT)
    if conf['random'] == "1":
        random_checkbutton.select()

    interval_container = Frame(setting_window)
    interval_container.pack(side=TOP)
    interval_label = Label(interval_container,
                           text=_('Change wallpaper every '),
                           font=('courier', 15, 'bold'))
    interval_label.pack(side=LEFT)
    interval_text = Text(interval_container, height=1, width=4)
    interval_text.insert(END, conf['interval'])
    interval_text.pack(side=LEFT)
    minute_label = Label(interval_container,
                         text=_(' minutes.'),
                         font=('courier', 15, 'bold'))
    minute_label.pack(side=LEFT)
开发者ID:funagi,项目名称:wallpapoz,代码行数:45,代码来源:wallpapoz_main_window.py

示例9: init_gui

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
    def init_gui(self):
        """init helper"""
        # setting up frames
        top_frame = Frame(self.root)
        mid_frame = Frame(self.root)
        radio_frame = Frame(self.root)
        res_frame = Frame(self.root)
        msg_frame = Frame(self.root)
        check_frame = Frame(self.root)
        history_frame = Frame(self.root)
        btn_frame = Frame(self.root)
        rating_frame = Frame(self.root)
        top_frame.pack(side=TOP, fill=X)
        mid_frame.pack(side=TOP, fill=X)
        history_frame.pack(side=TOP, fill=BOTH, expand=True)
        radio_frame.pack(side=TOP, fill=BOTH, expand=True)
        rating_frame.pack(side=TOP, fill=BOTH, expand=True)
        res_frame.pack(side=TOP, fill=BOTH, expand=True)
        check_frame.pack(side=TOP, fill=BOTH, expand=True)
        msg_frame.pack(side=TOP, fill=BOTH, expand=True)
        btn_frame.pack(side=TOP, fill=X)

        # Message ListBox
        rightscrollbar = Scrollbar(msg_frame)
        rightscrollbar.pack(side=RIGHT, fill=Y)
        bottomscrollbar = Scrollbar(msg_frame, orient=HORIZONTAL)
        bottomscrollbar.pack(side=BOTTOM, fill=X)
        self.lbMessages = Listbox(
            msg_frame, yscrollcommand=rightscrollbar.set, xscrollcommand=bottomscrollbar.set, bg="white"
        )
        self.lbMessages.pack(expand=True, fill=BOTH)
        rightscrollbar.config(command=self.lbMessages.yview)
        bottomscrollbar.config(command=self.lbMessages.xview)

        # History ListBoxes
        rightscrollbar2 = Scrollbar(history_frame)
        rightscrollbar2.pack(side=RIGHT, fill=Y)
        bottomscrollbar2 = Scrollbar(history_frame, orient=HORIZONTAL)
        bottomscrollbar2.pack(side=BOTTOM, fill=X)
        self.showhistory = Listbox(
            history_frame, yscrollcommand=rightscrollbar2.set, xscrollcommand=bottomscrollbar2.set, bg="white"
        )
        self.showhistory.pack(expand=True, fill=BOTH)
        rightscrollbar2.config(command=self.showhistory.yview)
        bottomscrollbar2.config(command=self.showhistory.xview)
        self.showhistory.bind("<Double-Button-1>", self.select_recent_file)
        self.set_history_window()

        # status bar
        self.status = Label(self.root, text="", bd=1, relief=SUNKEN, anchor=W)
        self.status.pack(side=BOTTOM, fill=X)

        # labels
        self.lblRatingLabel = Label(rating_frame, text="Rating:")
        self.lblRatingLabel.pack(side=LEFT)
        self.lblRating = Label(rating_frame, textvariable=self.rating)
        self.lblRating.pack(side=LEFT)
        Label(mid_frame, text="Recently Used:").pack(side=LEFT)
        Label(top_frame, text="Module or package").pack(side=LEFT)

        # file textbox
        self.txtModule = Entry(top_frame, background="white")
        self.txtModule.bind("<Return>", self.run_lint)
        self.txtModule.pack(side=LEFT, expand=True, fill=X)

        # results box
        rightscrollbar = Scrollbar(res_frame)
        rightscrollbar.pack(side=RIGHT, fill=Y)
        bottomscrollbar = Scrollbar(res_frame, orient=HORIZONTAL)
        bottomscrollbar.pack(side=BOTTOM, fill=X)
        self.results = Listbox(
            res_frame, yscrollcommand=rightscrollbar.set, xscrollcommand=bottomscrollbar.set, bg="white", font="Courier"
        )
        self.results.pack(expand=True, fill=BOTH, side=BOTTOM)
        rightscrollbar.config(command=self.results.yview)
        bottomscrollbar.config(command=self.results.xview)

        # buttons
        Button(top_frame, text="Open", command=self.file_open).pack(side=LEFT)
        Button(top_frame, text="Open Package", command=(lambda: self.file_open(package=True))).pack(side=LEFT)

        self.btnRun = Button(top_frame, text="Run", command=self.run_lint)
        self.btnRun.pack(side=LEFT)
        Button(btn_frame, text="Quit", command=self.quit).pack(side=BOTTOM)

        # radio buttons
        self.information_box = IntVar()
        self.convention_box = IntVar()
        self.refactor_box = IntVar()
        self.warning_box = IntVar()
        self.error_box = IntVar()
        self.fatal_box = IntVar()
        i = Checkbutton(
            check_frame,
            text="Information",
            fg=COLORS["(I)"],
            variable=self.information_box,
            command=self.refresh_msg_window,
        )
        c = Checkbutton(
#.........这里部分代码省略.........
开发者ID:OFFIS-Automation,项目名称:Framework,代码行数:103,代码来源:gui.py

示例10: GraphicalUserInterface

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

#.........这里部分代码省略.........
        self.aircraft_file_entry = Entry(self.input_frame, width=50)
        self.aircraft_file_entry.grid(row=4, sticky="E")
        self.aircraft_file_entry.insert(0, self.__aircraft_file)
        self.aircraft_file_button = Button(self.input_frame, text='Browse...', command=self.__get_aircraft_filename)
        self.aircraft_file_button.grid(row=5, sticky="E")

        self.empty_label = Label(self.input_frame, text=" ", width=425, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=6, sticky="W")

        # Text field where user can enter country-currency filepath
        self.currency_label = Label(self.input_frame, width=22, text="Currency list: ", anchor='w')
        self.currency_label.grid(row=7, sticky="W")
        self.currency_entry = Entry(self.input_frame, width=50)
        self.currency_entry.grid(row=7, sticky="E")
        self.currency_entry.insert(0, self.__currency_file)
        self.currency_button = Button(self.input_frame, text='Browse...', command=self.__get_currency_filename)
        self.currency_button.grid(row=8, sticky="E")

        self.empty_label = Label(self.input_frame, text=" ", width=60, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=9, sticky="W")

        # Text field where user can enter exchange rate filepath
        self.exchange_rate_label = Label(self.input_frame, width=22, text="Exchange rate list: ", anchor='w')
        self.exchange_rate_label.grid(row=10, sticky="W")
        self.exchange_rate_entry = Entry(self.input_frame, width=50)
        self.exchange_rate_entry.grid(row=10, sticky="E")
        self.exchange_rate_entry.insert(0, self.__exchange_rate_file)
        self.exchange_rate_button = Button(self.input_frame, text='Browse...', command=self.__get_exchange_rate_filename)
        self.exchange_rate_button.grid(row=11, sticky="E")

        # real-time exchange rates checkbox
        self.forex = Checkbutton(self.input_frame, text="Use real-time exchange rates", variable=self.__exchvar,
                                 command=self.__forex_toggle)
        self.forex.select()
        self.forex.grid(row=12, sticky="W")

        # manage output frame
        self.output_frame = LabelFrame(self, text="Output", font=("Helvetica", 14), width=300)
        self.output_frame.place(x=500, y=550)

        self.empty_label = Label(self.output_frame, text=" ", width=60, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=0, sticky="W")

        # Text field where user can enter output filepath
        self.output_label = Label(self.output_frame, width=22, text="Output file: ", anchor='w')
        self.output_label.grid(row=1, sticky="W")
        self.output_entry = Entry(self.output_frame, width=50)
        self.output_entry.grid(row=1, sticky="E")
        self.output_entry.insert(0, self.__output_file)
        self.output_button = Button(self.output_frame, text='Browse...', command=self.__get_output_filename)
        self.output_button.grid(row=2, sticky="E")

        # append date to output filename checkbox
        self.datetime_cb = Checkbutton(self.output_frame,
                                       text="Append date and time to filename (e.g., bestroutes 20151218 160000.csv)",
                                       variable=self.__datevar, command=self.__datetime_toggle)
        self.datetime_cb.grid(row=3, sticky="W")
        self.datetime_cb.select()

    # GUI methods

    def __forex_toggle(self):
        if self.__exchvar.get() == True:
            self.__exchrate = True
        else:
            self.__exchrate = False
开发者ID:shanecroberts,项目名称:FuelManager,代码行数:70,代码来源:FuelManager.py

示例11:

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import select [as 别名]
else:
    opcije="0|||".split("|")
#else:
#    os.makedirs("C:\\EOP")
#    opcije="0||".split("|")
    



t.title('EOP')
t.config(bg='green',width = 300,height = 600)

c1=Checkbutton(t,text="Remember me",variable=remember,bg='lightblue',activebackground="blue")
c1.place(x=105,y=450)
if opcije[0]=="1":
    c1.select()

l1=Label(t,text="REGISTER TO EOP",font=("Verdana",18),bg='pink')
l1.place(x=40,y=1)

l2=Label(t,text="USERNAME:",bg='pink')
l2.place(x=5,y=50)
l3=Label(t,text="E-MAIL:",bg='pink')
l3.place(x=5,y=100)
l4=Label(t,text="PASSWORD:",bg='pink')
l4.place(x=5,y=150)
e1=Entry(t,textvariable=StringVar(t, value=''))
e1.place(x=80,y=51)
e2=Entry(t,textvariable=StringVar(t, value=''))
e2.place(x=80,y=101)
e3=Entry(t,show="*",textvariable=StringVar(t, value=''))
开发者ID:vanjavk,项目名称:EOPgameserver,代码行数:33,代码来源:eopclient.py


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