python类Checkbutton()的实例源码

collapsiblepane.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent, expanded_text="Collapse <<", collapsed_text="Expand >>", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._expanded_text = expanded_text
        self._collapsed_text = collapsed_text

        self.columnconfigure(1, weight=1)

        self._variable = tk.IntVar()
        self._button = ttk.Checkbutton(self, variable=self._variable, command=self._activate, style="TButton")
        self._button.grid(row=0, column=0)

        self._separator = ttk.Separator(self, orient="horizontal")
        self._separator.grid(row=0, column=1, sticky="we")

        self.frame = ttk.Frame(self)

        self._activate()
test_widgets.py 文件源码 项目:Craft-Clash 作者: Derpyface-Development-Co 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        cbtn = ttk.Checkbutton(self.root, command=cb_test)
        # the variable automatically created by ttk.Checkbutton is actually
        # undefined till we invoke the Checkbutton
        self.assertEqual(cbtn.state(), ('alternate', ))
        self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar,
            cbtn['variable'])

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(cbtn['onvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
        self.assertTrue(success)

        cbtn['command'] = ''
        res = cbtn.invoke()
        self.assertFalse(str(res))
        self.assertLessEqual(len(success), 1)
        self.assertEqual(cbtn['offvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
test_widgets.py 文件源码 项目:Craft-Clash 作者: Derpyface-Development-Co 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        cbtn = ttk.Checkbutton(self.root, command=cb_test)
        # the variable automatically created by ttk.Checkbutton is actually
        # undefined till we invoke the Checkbutton
        self.assertEqual(cbtn.state(), ('alternate', ))
        self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar,
            cbtn['variable'])

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(cbtn['onvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
        self.assertTrue(success)

        cbtn['command'] = ''
        res = cbtn.invoke()
        self.assertFalse(str(res))
        self.assertLessEqual(len(success), 1)
        self.assertEqual(cbtn['offvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
toggledlabelframe.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parent, on_text="Active", off_text="Inactive", default_state=False, state="enabled", *args):
        ttk.LabelFrame.__init__(self, parent, labelanchor="n", *args)
        self.parent = parent
        self._on_text = on_text
        self._off_text = off_text
        self._default_state = default_state
        self._state = state

        self._fill = tk.Frame(self, height=5)

        self._variable = tk.IntVar()
        self._variable.set(default_state)

        self._button = ttk.Checkbutton(self, width=11, state=self._state, variable=self._variable, command=self._activate, style="TButton")
        self.configure(labelwidget=self._button)

        self.frame = ttk.Frame(self)

        self._activate()
gui.py 文件源码 项目:skan 作者: jni 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def create_parameters_frame(self, parent):
        parameters = ttk.Frame(master=parent, padding=STANDARD_MARGIN)
        parameters.grid(sticky='nsew')

        heading = ttk.Label(parameters, text='Analysis parameters')
        heading.grid(column=0, row=0, sticky='n')

        for i, param in enumerate(self.parameters, start=1):
            param_label = ttk.Label(parameters, text=param._name)
            param_label.grid(row=i, column=0, sticky='nsew')
            if type(param) == tk.BooleanVar:
                param_entry = ttk.Checkbutton(parameters, variable=param)
            elif hasattr(param, '_choices'):
                param_entry = ttk.OptionMenu(parameters, param, param.get(),
                                             *param._choices.keys())
            else:
                param_entry = ttk.Entry(parameters, textvariable=param)
            param_entry.grid(row=i, column=1, sticky='nsew')
test_widgets.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        cbtn = ttk.Checkbutton(command=cb_test)
        # the variable automatically created by ttk.Checkbutton is actually
        # undefined till we invoke the Checkbutton
        self.assertEqual(cbtn.state(), ('alternate', ))
        self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar,
            cbtn['variable'])

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(cbtn['onvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
        self.assertTrue(success)

        cbtn['command'] = ''
        res = cbtn.invoke()
        self.assertEqual(res, '')
        self.assertFalse(len(success) > 1)
        self.assertEqual(cbtn['offvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
references.py 文件源码 项目:Colony 作者: DeflatedPickle 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent, option, **kwargs):
        ttk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.option = option

        # TODO: Add more options.

        ttk.Checkbutton(self, text="Debugging Mode", variable=self.option.variable_debug).grid(row=0, column=0, sticky="we")
        ttk.Checkbutton(self, text="Scrollbars", variable=self.option.variable_scrollbars).grid(row=1, column=0, sticky="we")
        ttk.Checkbutton(self, text="Grid", variable=self.option.variable_grid).grid(row=2, column=0, sticky="we")
        ttk.Checkbutton(self, text="Grid Highlight", variable=self.option.variable_grid_highlight).grid(row=3, column=0, sticky="we")

        frame_colour = ttk.Frame(self)
        ttk.Label(frame_colour, text="Highlight Colour").grid(row=0, column=0)
        ttk.Combobox(frame_colour, textvariable=self.option.variable_highlight_colour, values=["white", "red", "blue", "yellow", "green", "purple", "orange", "pink"], state="readonly", width=7).grid(row=0, column=1)
        frame_colour.grid(row=4, column=0, sticky="we")

        ttk.Checkbutton(self, text="Extra Speed Arrows", variable=self.option.variable_extra_speed_arrows).grid(row=5, column=0, sticky="we")
test_widgets.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        cbtn = ttk.Checkbutton(self.root, command=cb_test)
        # the variable automatically created by ttk.Checkbutton is actually
        # undefined till we invoke the Checkbutton
        self.assertEqual(cbtn.state(), ('alternate', ))
        self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar,
            cbtn['variable'])

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(cbtn['onvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
        self.assertTrue(success)

        cbtn['command'] = ''
        res = cbtn.invoke()
        self.assertFalse(str(res))
        self.assertLessEqual(len(success), 1)
        self.assertEqual(cbtn['offvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
test_widgets.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        cbtn = ttk.Checkbutton(self.root, command=cb_test)
        # the variable automatically created by ttk.Checkbutton is actually
        # undefined till we invoke the Checkbutton
        self.assertEqual(cbtn.state(), ('alternate', ))
        self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar,
            cbtn['variable'])

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(cbtn['onvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
        self.assertTrue(success)

        cbtn['command'] = ''
        res = cbtn.invoke()
        self.assertFalse(str(res))
        self.assertLessEqual(len(success), 1)
        self.assertEqual(cbtn['offvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
Spectroscope.py 文件源码 项目:Spectroscope 作者: magin67 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def SetPlotWidgets(self, rowControl):
        ## ??? ???????
        def SetPlotType(val):
            self.shSpectr.PlotType = val
            self.shSpectr.ShowSp()

        def ChkShowTitle():
            self.shSpectr.ShowTitle = showTitle.get()
            self.shSpectr.ShowSp()

        rowControl = self.AddLabel(rowControl, "Plot type", colsp=1)

        vPlotTypes = SD.ShowSpectr.PlotTypes() #self.shSpectr
        sPlotType = tk.StringVar(self.frControl)
        self.omPlotType = ttk.OptionMenu(self.frControl, sPlotType, self.shSpectr.PlotType, *vPlotTypes, command=SetPlotType)  
        PlaceWidget(self.omPlotType, rowControl, col=1, stick='wn') 

        showTitle = tk.BooleanVar()
        showTitle.set(self.shSpectr.ShowTitle)
        self.chkshowTitle = ttk.Checkbutton(self.frControl, variable=showTitle, text="Titles", onvalue=True, offvalue=False, command=ChkShowTitle)
        rowControl = PlaceWidget(self.chkshowTitle, rowControl, col=1, stick='e') 

        return rowControl
        #return self.AddLabel(rowControl)
test_widgets.py 文件源码 项目:Craft-Clash 作者: Derpyface-Development-Co 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def create(self, **kwargs):
        return ttk.Checkbutton(self.root, **kwargs)
test_widgets.py 文件源码 项目:Craft-Clash 作者: Derpyface-Development-Co 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def create(self, **kwargs):
        return ttk.Checkbutton(self.root, **kwargs)
toolbar.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def add_checkbutton(self, text="", image="", variable=None, command=None, side="left"):
        """Adds a CheckButton to the Toolbar."""
        widget = ttk.Checkbutton(self, text=text, image=image, variable=variable, command=command, style="Toolbutton")
        widget.pack(side=side)

        return widget
togglebutton.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent, text_on="On", text_off="Off", *args):
        ttk.Checkbutton.__init__(self, parent, style="TButton", *args)
        self.parent = parent
        self._text_on = text_on
        self._text_off = text_off

        self._variable = tk.IntVar()
        self.configure(variable=self._variable, command=self._activate)

        self._activate()
lockbutton.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, lock_text="Lock", lock_image="", unlock_text="Unlock", unlock_image="", *args):
        ttk.Checkbutton.__init__(self, parent, compound="left", command=self._activate, style="TButton", *args)
        self.parent = parent
        self._lock_text = lock_text
        self._unlock_text = unlock_text

        self._lock_image = tk.PhotoImage(file=lock_image)
        self._unlock_image = tk.PhotoImage(file=unlock_image)

        self._variable = tk.IntVar()
        self._variable.set(True)

        self.configure(variable=self._variable)

        self._activate()
gui.py 文件源码 项目:StochOPy 作者: keurfonluu 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def frame1_sync(self):
        if not self.frame1.first_run:
            self.frame1.sync.forget()
        self.frame1.sync = ttk.Frame(self.frame1, borderwidth = 0)
        self.frame1.sync.place(width = 170, height = 25, relx = 0.35, y = 55, anchor = "nw")
        if self.solver_name.get() in [ "CPSO", "PSO", "DE" ]:
            # sync
            sync_button = ttk.Checkbutton(self.frame1.sync, text = "Synchronize",
                                          variable = self.sync, takefocus = False)

            # Layout
            sync_button.place(relx = 0, x =0, y = 0, anchor = "nw")
frame_dataset_flatfile.py 文件源码 项目:qal 作者: OptimalBPM 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def init_widgets(self):
        # file selector
        self.btn_file_select=Button(self, text="Select file",command=self.on_select)
        self.btn_file_select.grid(column=0, row=0, columnspan=2)
        # filename
        self.filename, self.e_filename, self.l_filename = make_entry(self,"File name: ", 1)

        # delimiter
        self.delimiter, self.e_delimiter, self.l_delimiter = make_entry(self,"Delimiter: ", 2)

        # has_header
        self.l_has_header = ttk.Label(self, text="Has header: ")
        self.l_has_header.grid(column=0, row=3, sticky=W)
        self.has_header = BooleanVar()
        self.e_has_header = ttk.Checkbutton(self, variable=self.has_header)
        self.e_has_header.grid(column=1, row=3, sticky=W)

        # csv_dialect
        self.csv_dialect, self.e_csv_dialect, self.l_csv_dialect = make_entry(self,"CSV dialect: ", 4)

        # quoting
        self.quoting, self.e_quoting, self.l_quoting = make_entry(self, "Quoting: ", 5)

        # escapechar
        self.escapechar, self.e_escapechar, self.l_escapechar = make_entry(self, "Escape character: ", 6)

        # lineterminator
        self.lineterminator, self.e_lineterminator, self.l_lineterminator = make_entry(self, "Line terminator: ", 7)

        # quotechar
        self.quotechar, self.e_quotechar, self.l_quotechar = make_entry(self, "Quote character: ", 8)

        # skipinitialspace
        self.skipinitialspace, self.e_skipinitialspace, self.l_skipinitialspace = make_entry(self, "Skip initial space: ", 9)
frame_mapping.py 文件源码 项目:qal 作者: OptimalBPM 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def init_widgets(self):

        """Init all widgets"""

        # Source reference
        self.cb_source_ref = ttk.Combobox(self, textvariable=self.src_reference, state='normal')
        self.cb_source_ref['values'] = self.get_source_references()
        self.cb_source_ref.pack(side=LEFT, fill=X, expand=1)


        # Data type label
        self.l_data_type = ttk.Label(self, textvariable=self.src_datatype, width=8)
        self.src_datatype.set("Not set")

        self.l_data_type.pack(side=LEFT)

        # Dest reference
        self.cb_dest_ref = ttk.Combobox(self, textvariable=self.dest_reference, state='normal')
        self.cb_dest_ref['values'] = self.get_destination_references()
        self.cb_dest_ref.pack(side=RIGHT, fill=X, expand=1)

        # Is key field
        self.cb_is_key = ttk.Checkbutton(self, variable=self.is_key)
        self.cb_is_key.pack(side=RIGHT)

        # Current data
        self.l_data = ttk.Label(self, textvariable=self.curr_data)
        self.curr_data.set("No data")
        self.l_data.pack(side=RIGHT, fill=X, padx=5)
frame_dataset_spreadsheet.py 文件源码 项目:qal 作者: OptimalBPM 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def init_widgets(self):
        # file selector
        self.btn_file_select = Button(self, text="Select file", command=self.on_select)
        self.btn_file_select.grid(column=0, row=0, columnspan=2)

        # filename
        self.filename, self.e_filename, self.l_filename = make_entry(self, "File name: ", 1)


        # delimiter
        self.delimiter, self.e_delimiter, self.l_delimiter = make_entry(self, "Delimiter: ", 2)

        # has_header
        self.l_has_header = ttk.Label(self, text="Has header: ")
        self.l_has_header.grid(column=0, row=3, sticky=W)
        self.has_header = BooleanVar()
        self.e_has_header = ttk.Checkbutton(self, variable=self.has_header)
        self.e_has_header.grid(column=1, row=3, sticky=W)

        # sheet_name
        self.sheet_name, self.e_sheet_name, self.l_sheet_name = make_entry(self, "Sheet name: ", 4)

        # x_offset
        self.x_offset, self.e_x_offset, self.l_x_offset = make_entry(self, "X offset: ", 5)


        # y_offset
        self.y_offset, self.e_y_offset, self.l_y_offset = make_entry(self, "Y offset: ", 6)
test_widgets.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def create(self, **kwargs):
        return ttk.Checkbutton(self.root, **kwargs)
window.py 文件源码 项目:quill 作者: DeflatedPickle 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def insert_tk_checkbutton(self, index: int or str="end", *args, **kwargs):
        """Insert a tk.Checkbutton into the game."""
        widget = tk.Checkbutton(self.text, **kwargs)
        self.text.window_create(index, window=widget)

        return widget
window.py 文件源码 项目:quill 作者: DeflatedPickle 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def insert_ttk_checkbutton(self, command=None, offvalue: int=0, onvalue: int=1, variable: tk.BooleanVar=None, index: int or str="end", *args, **kwargs):
        """Insert a ttk.Checkbutton into the game."""
        widget = ttk.Checkbutton(self.text, command=command, offvalue=offvalue, onvalue=onvalue, variable=variable, **kwargs)
        self.text.window_create(index, window=widget)

        return widget
settings.py 文件源码 项目:porcupine 作者: Akuli 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def add_frame(self, triangle_key):
        """Add a ``ttk.Frame`` to the dialog and return it.

        The frame will contain a label that displays a |triangle| when
        the value of the variable from :meth:`get_var` is invalid. The
        triangle label is packed with ``side='right'``.

        For example, :meth:`add_checkbutton` works roughly like this::

            frame = section.add_frame(key)
            var = section.get_var(key, tkinter.BooleanVar)
            ttk.Checkbutton(frame, text=text, variable=var).pack(side='left')
        """
        frame = ttk.Frame(self.content_frame)
        frame.pack(fill='x')

        if triangle_key is not None:
            errorvar = self._infos[triangle_key].errorvar
            triangle_label = ttk.Label(frame)
            triangle_label.pack(side='right')

            def on_errorvar_changed(*junk):
                if errorvar.get():
                    triangle_label['image'] = 'img_triangle'
                else:
                    triangle_label['image'] = self._get_fake_triangle(frame)

            errorvar.trace('w', on_errorvar_changed)
            on_errorvar_changed()

        return frame
settings.py 文件源码 项目:porcupine 作者: Akuli 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def add_checkbutton(self, key, text):
        """Add a ``ttk.Checkbutton`` that sets an option to a bool."""
        var = self.get_var(key, tkinter.BooleanVar)
        ttk.Checkbutton(self.add_frame(key), text=text,
                        variable=var).pack(side='left')
find.py 文件源码 项目:porcupine 作者: Akuli 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, parent, textwidget, **kwargs):
        super().__init__(parent, **kwargs)

        self._last_pattern = None
        self._matches = None

        self.grid_columnconfigure(1, weight=1)
        self._textwidget = textwidget

        entrygrid = ttk.Frame(self)
        entrygrid.grid(row=0, column=0)
        self._find_entry = self._add_entry(entrygrid, 0, "Find:", self.find)
        self._replace_entry = self._add_entry(entrygrid, 1, "Replace with:")

        buttonframe = ttk.Frame(self)
        buttonframe.grid(row=1, column=0, sticky='we')
        buttons = [
            ("Find", self.find),
            ("Replace", self.replace),
            ("Replace and find", self.replace_and_find),
            ("Replace all", self.replace_all),
        ]
        for text, command in buttons:
            button = ttk.Button(buttonframe, text=text, command=command)
            button.pack(side='left', fill='x', expand=True)

        self._full_words_var = tkinter.BooleanVar()
        checkbox = ttk.Checkbutton(self, text="Full words only",
                                   variable=self._full_words_var)
        checkbox.grid(row=0, column=1, sticky='nw')

        self._statuslabel = ttk.Label(self)
        self._statuslabel.grid(row=1, column=1, columnspan=2, sticky='nswe')

        closebutton = ttk.Label(self, image='img_closebutton')
        closebutton.grid(row=0, column=2, sticky='ne')
        closebutton.bind('<Button-1>', lambda event: self.pack_forget())
test_widgets.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def create(self, **kwargs):
        return ttk.Checkbutton(self.root, **kwargs)
tiles.py 文件源码 项目:LadderiLogical 作者: mikadam 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, *args):

        super().__init__(*args)


        self.dir_selector=DirectionSelector(self.frame,self.conector_checks)
        self.dir_selector.pack()

        for check in self.conector_checks:
            check.trace("w",self.dir_selector.variable_changed)

        self.invert=tk.IntVar()
        self.invert_cheack=ttk.Checkbutton(master=self.frame,text="Invert",variable=self.invert,onvalue='0',offvalue='1')

        self.invert.set(1)
        self.invert_cheack.pack()

        vcmd = (self.root.register(self.validate), '%S','%d')

        self.subscribe_name=ttk.Entry(master=self.frame,width=10,validate="key",validatecommand=vcmd)
        self.subscribe_name.pack()



        self.top_box=self.board.canvas.create_rectangle((self.x+0.3)*self.board.tile_size,(self.y+0.7)*self.board.tile_size,(self.x+0.7)*self.board.tile_size,(self.y)*self.board.tile_size,fill="",outline="")
        self.bottom_box=self.board.canvas.create_rectangle((self.x+0.3)*self.board.tile_size,(self.y+0.3)*self.board.tile_size,(self.x+0.7)*self.board.tile_size,(self.y+1)*self.board.tile_size,fill="",outline="")
        self.left_box=self.board.canvas.create_rectangle((self.x+0.7)*self.board.tile_size,(self.y+0.7)*self.board.tile_size,(self.x)*self.board.tile_size,(self.y+0.3)*self.board.tile_size,fill="",outline="")
        self.right_box=self.board.canvas.create_rectangle((self.x+0.3)*self.board.tile_size,(self.y+0.3)*self.board.tile_size,(self.x+1)*self.board.tile_size,(self.y+0.7)*self.board.tile_size,fill="",outline="")

        self.gen_box=self.board.canvas.create_rectangle((self.x+0.2)*self.board.tile_size,(self.y+0.2)*self.board.tile_size,(self.x+0.8)*self.board.tile_size,(self.y+0.8)*self.board.tile_size,fill="#2e2e2e",outline="#EEEEEE") 
        self.on_box=self.board.canvas.create_rectangle((self.x+0.4)*self.board.tile_size,(self.y+0.4)*self.board.tile_size,(self.x+0.6)*self.board.tile_size,(self.y+0.6)*self.board.tile_size,fill="",outline="")
        self.missing_key=self.board.canvas.create_text((self.x+0.5)*self.board.tile_size,(self.y+0.5)*self.board.tile_size,text="?",fill="")

        self.graphic_conectors=[self.top_box,self.right_box,self.bottom_box,self.left_box]
        self.graphics=[self.on_box,self.gen_box,self.top_box,self.bottom_box,self.left_box,self.right_box,self.missing_key]
tiles.py 文件源码 项目:LadderiLogical 作者: mikadam 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, *args):

        super().__init__(*args)


        self.conector_checks[0].set(0)
        self.conector_checks[1].set(1)
        self.conector_checks[2].set(1)
        self.conector_checks[3].set(2)

        vcmd = (self.root.register(self.validate), '%P', '%s','%S', '%d')

        self.count_upto=ttk.Entry(master=self.frame,width=10,validate="key",validatecommand=vcmd)
        self.count_upto.pack()
        self.count_upto.insert(0,"1")

        self.upto=1
        self.counter=0
        self.edge=0

        self.auto_reset=tk.IntVar()
        self.auto_reset_cheack=ttk.Checkbutton(master=self.frame,text="Auto Reset",variable=self.auto_reset,onvalue='1',offvalue='0')

        self.auto_reset.set(1)
        self.auto_reset_cheack.pack()

        self.top_box=self.board.canvas.create_rectangle((self.x+0.3)*self.board.tile_size,(self.y+0.7)*self.board.tile_size,(self.x+0.7)*self.board.tile_size,(self.y)*self.board.tile_size,fill="",outline="")
        self.bottom_box=self.board.canvas.create_rectangle((self.x+0.3)*self.board.tile_size,(self.y+0.3)*self.board.tile_size,(self.x+0.7)*self.board.tile_size,(self.y+1)*self.board.tile_size,fill="#FF0000",outline="")
        self.left_box=self.board.canvas.create_rectangle((self.x+0.7)*self.board.tile_size,(self.y+0.7)*self.board.tile_size,(self.x)*self.board.tile_size,(self.y+0.3)*self.board.tile_size,fill="#FF0000",outline="")
        self.right_box=self.board.canvas.create_rectangle((self.x+0.3)*self.board.tile_size,(self.y+0.3)*self.board.tile_size,(self.x+1)*self.board.tile_size,(self.y+0.7)*self.board.tile_size,fill="#FF0000",outline="")

        self.counter_box=self.board.canvas.create_rectangle((self.x+0.2)*self.board.tile_size,(self.y+0.2)*self.board.tile_size,(self.x+0.8)*self.board.tile_size,(self.y+0.8)*self.board.tile_size,fill="#DDDDDD",outline="#EEEEEE") 

        self.text_box=self.board.canvas.create_text((self.x+0.5)*self.board.tile_size,(self.y+0.5)*self.board.tile_size,text="00+")



        self.graphic_conectors=[self.top_box,self.right_box,self.bottom_box,self.left_box]

        self.graphics=[self.counter_box,self.top_box,self.bottom_box,self.left_box,self.right_box,self.text_box]
guiwin.py 文件源码 项目:pysaf 作者: cstarcher 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def create_zip_button(self, gs):
        """Expand frame to reveal options when Create ZIP File is selected."""
        if self.zip_button_var.get() == 1:
            self.split_button_var = tk.IntVar()
            self.split_button = ttk.Checkbutton(self.zip_frame,
                                                text='Split ZIP File',
                                                variable=self.split_button_var)
            self.split_button.grid(row=2, column=0, sticky='w')
            self.split_button.grid_configure(padx=2, pady=5)
            self.split_entry_var = tk.IntVar()
            self.split_entry = ttk.Entry(self.zip_frame,
                                         width=3,
                                         justify='right',
                                         textvariable=self.split_entry_var)
            self.split_entry.grid(row=2, column=1, sticky='e')
            self.split_entry.grid_configure(pady=5)
            self.split_entry_var.set('2')
            self.split_combo = ttk.Combobox(self.zip_frame,
                                            width=4,
                                            justify='left',
                                            values='MB GB')
            self.split_combo.current(1)
            self.split_combo.grid(row=2, column=2, sticky='w')
            self.split_combo.grid_configure(pady=5)
        else:
            self.split_button.destroy()
            self.split_entry.destroy()
            self.split_combo.destroy()
gui.py 文件源码 项目:pysaf 作者: cstarcher 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def create_zip_button(self, gs):
        """Expand frame to reveal options when Create ZIP File is selected."""
        if self.zip_button_var.get() == 1:
            self.split_button_var = tk.IntVar()
            self.split_button = ttk.Checkbutton(self.zip_frame,
                                                text='Split ZIP File',
                                                variable=self.split_button_var)
            self.split_button.grid(row=2, column=0, sticky='w')
            self.split_button.grid_configure(padx=2, pady=5)
            self.split_entry_var = tk.IntVar()
            self.split_entry = ttk.Entry(self.zip_frame,
                                         width=3,
                                         justify='right',
                                         textvariable=self.split_entry_var)
            self.split_entry.grid(row=2, column=1, sticky='e')
            self.split_entry.grid_configure(pady=5)
            self.split_entry_var.set('2')
            self.split_combo = ttk.Combobox(self.zip_frame,
                                            width=4,
                                            justify='left',
                                            values='MB GB')
            self.split_combo.current(1)
            self.split_combo.grid(row=2, column=2, sticky='w')
            self.split_combo.grid_configure(pady=5)
        else:
            self.split_button.destroy()
            self.split_entry.destroy()
            self.split_combo.destroy()


问题


面经


文章

微信
公众号

扫码关注公众号