예제 #1
0
    def __init__(self, **kwargs):
        """
        Constructor

        root - reference to the wdiget containing this widget
        """
        Button.__init__(self, **kwargs)
        self["text"] = "Start/Stop"
예제 #2
0
 def __init__(self, cell, master, **kw):
     Button.__init__(self,
                     master=master,
                     text=' ',
                     command=self.on_click,
                     **kw)
     self.grid(row=cell.x, column=cell.y)
     self.cell = cell
     self.update_cell_color()
예제 #3
0
 def __init__(self, master, **kw):
     # initialize super class
     Button.__init__(self, master=master, **kw)
     # set default background to background
     self.defaultBackground = self["background"]
     # bind self.on_enter with "<Enter>" event
     self.bind("<Enter>", self.on_enter)
     # bind self.on_leave with "<Leave>" event
     self.bind("<Leave>", self.on_leave)
예제 #4
0
 def __init__(self, master=None):
     Button.__init__(self, master)
     self.master = master
     self["width"] = 4
     self["height"] = 2
     self["command"] = self._on_click
     self["background"] = 'grey'
     self["borderwidth"] = 1
     self["font"] = (12)
예제 #5
0
 def __init__(self, parent=None, exfunc=None, **configs):
     '''
     Constructor
     '''
     Button.__init__(self, parent, **configs)
     self.bind('<Button-1>', self.click_event)  #bind button click event
     if not configs['text']:
         self.config(text='...')
     self.__exfunc = exfunc
예제 #6
0
 def __init__(self, master=None, x=0, y=0, colour=None):
     Button.__init__(self, master, relief="flat", fg = "#444", font = ("Ariel", 10),
                     bd=0, command=self.command)
     self.x, self.y = x, y
     self.select=False
     
     if colour: self.pile = [colour]
     else: self.pile = []
     self.colourize()
     self.pile_size_display()
예제 #7
0
 def __init__(self, parent=None, exFuncs=None, **configs):
     '''
     Constructor
     '''
     Button.__init__(self, parent, **configs)
     self.bind('<Button-1>', self.click_event) #bind button click event
     
     if isinstance(exFuncs, dict):
         self.__loadfunc = exFuncs.get('loadFunc')
         self.__setfunc = exFuncs.get('setFunc')
예제 #8
0
 def __init__(self, master, command, file_name):
     Button.__init__(self,
                     master,
                     bg='SkyBlue4',
                     command=command,
                     activebackground='midnight blue',
                     border=5)
     image = PhotoImage(file=file_name).subsample(x=4, y=4)
     self.configure(image=image)
     self.image = image
예제 #9
0
 def __init__(self, theme, *args, **kwargs):
     Button.__init__(self, *args, **kwargs)
     self['bg'] = theme.bg2
     self['fg'] = theme.fg
     self['borderwidth'] = 10
     self['relief'] = 'flat'
     self['activebackground'] = theme.fg
     self['activeforeground'] = theme.bg
     self['pady'] = 0
     self['padx'] = 2
예제 #10
0
    def __init__(self, parent=None, exFuncs=None, btnText='Button', **configs):
        '''
        Constructor
        '''
        Button.__init__(self, parent, **configs)
        self.bind('<Button-1>', self.click_event)  #bind button click event
        self.config(text=btnText)

        if isinstance(exFuncs, dict):
            self.__selffunc = exFuncs.get('process')
예제 #11
0
 def __init__(self, *args, **kwargs):
     Button.__init__(self, *args, **kwargs)
     self['relief'] = FLAT
     self['fg'] = '#ddd'
     self['bg'] = foreground
     self['font'] = font
     self['cursor'] = 'hand1'
     self['highlightbackground'] = foreground
     self['activebackground'] = h_foreground
     self['activeforeground'] = '#ddd'
     self['pady'] = 0
예제 #12
0
 def __init__(self, root=None, text="", style=None, command=None):
     Button.__init__(self,
                     text=text,
                     cursor="hand1",
                     bg=self.__to_background_color(style),
                     bd=0,
                     command=command,
                     width=300 // 4,
                     font=Font(family=CalculatorButton.FONT_FAMILY,
                               size=CalculatorButton.FONT_SIZE))
     self.__root = root
예제 #13
0
파일: utils.py 프로젝트: lampask/snak
 def __init__(self, master, highlightthickness=5, bg=globals.BOARD_COLOR.get(), fg=globals.UI_OUTLINE.get(),
              highlightbackground=globals.UI_OUTLINE.get(), activebackground=globals.UI_OUTLINE.get(), update=True, override=None,
              relief="flat", *args, **kwargs):
     Button.__init__(self, master, highlightthickness=highlightthickness, bg=bg, fg=fg,
                     highlightbackground=highlightbackground, activebackground=activebackground,
                     relief=relief, *args, **kwargs)
     if update:
         globals.events.setting_change += lambda: self.config(bg=globals.BOARD_COLOR.get(), fg=globals.UI_OUTLINE.get(),
                                                              highlightbackground=globals.UI_OUTLINE.get(), activebackground=globals.UI_OUTLINE.get())
     else:
         globals.events.setting_change += lambda: self.config(bg=override.get(), fg=globals.UI_OUTLINE.get(),
                                                              highlightbackground=globals.UI_OUTLINE.get(), activebackground=globals.UI_OUTLINE.get())
예제 #14
0
 def __init__(self, master=None, cnf={}, **kw):
     Button.__init__(self, master, cnf, **kw)
     self.config(
         compound=TkC.TOP,
         relief=TkC.FLAT,
         bd=0,
         bg="#b91d47",  # dark-red
         fg="white",
         activebackground="#b91d47",  # dark-red
         activeforeground="white",
         highlightthickness=0,
         font=("Droid Sans Mono", "16"))
예제 #15
0
    def __init__(self, master, name, port):
        Button.__init__(self,
                        master,
                        text=name,
                        width=8,
                        height=3,
                        command=self.buttonEvent)

        self.pack()

        self.port = port
        self.connection = SerialConnection()
예제 #16
0
파일: pimenu.py 프로젝트: derphilipp/pimenu
    def __init__(self, master=None, cnf={}, **kw):
        Button.__init__(self, master, cnf, **kw)
        self.config(
            compound=TkC.TOP,
            relief=TkC.FLAT,
            bd=0,
            bg="#b91d47",  # dark-red
            fg="white",
            activebackground="#b91d47",  # dark-red
            activeforeground="white",
            highlightthickness=0,
            font=("Droid Sans Mono", "16")

        )
예제 #17
0
 def __init__(self, master, **kw):
     bg = window_bg
     Button.__init__(self, 
         padx = 0,
         pady = 0,
         master = master,
         background = bg, 
         foreground = "black",
         activebackground = bg, 
         activeforeground = "black",
         borderwidth = '0',
         highlightthickness = '0', **kw)
     self.defaultBackground = self["background"]
     self.bind("<Enter>", self.on_enter)
     self.bind("<Leave>", self.on_leave)
예제 #18
0
 def __init__(self, currentWin, winX: int, winY: int):
     placeX = winX - 30
     placeY = 6
     fntAwes = Font(family='Font Awesome 5 Free Solid', size=12)
     Button.__init__(self,
                     currentWin,
                     text="x",
                     command=currentWin.quit,
                     bg=BGCOLOR,
                     fg=FGCOLOR,
                     width="1",
                     padx=5,
                     pady=2,
                     font=fntAwes)
     # Button.__init__(self,currentWin, text="", command=currentWin.quit, bg=BGCOLOR, fg=FGCOLOR, width="1",padx=5,pady=2,font=fntAwes)
     self.place(x=placeX, y=placeY)
예제 #19
0
    def __init__(self, pmaster, ptext=None, pcommand=None, pstyle="DEFAULT"):
        """
		Initialization Function
		:param pmaster: Master Frame
		:param ptext: Text to display on button
		:param pcommand: Command button will execute
		:param pstyle: User-defined style or default as string
		"""
        Button.__init__(self, pmaster)
        self.config(text=ptext)
        self.config(command=pcommand)

        try:
            self.avkbConfigure(AVKButtonStyles[pstyle])
        except KeyError:
            raise AVKButton.InvalidAVKButtonTypeError(pstyle)
예제 #20
0
    def __init__(self, parent=None, exFuncs=None, module=None, **configs):
        '''
        Constructor
        '''
        Button.__init__(self, parent, **configs)
        self.bind('<Button-1>', self.click_event)

        self.__module = module

        if isinstance(exFuncs, dict):
            self.__before_click_event = exFuncs.get('before')
            self.__process_click_event = exFuncs.get('process')
            self.__cancel_click_event = exFuncs.get('cancel')
        else:
            self.__before_click_event = None
            self.__process_click_event = None
            self.__cancel_click_event = None
예제 #21
0
 def __init__(self, root, chat_name, chat_id, external_id, contacts,
              new_msgs,
              client):  #todo to add new_msgs parameter to this function
     Button.__init__(self,
                     root,
                     text=chat_name,
                     command=lambda: self.chat_request(),
                     width=10)
     self.client = client
     self.chat_name = chat_name
     self.chat_id = str(chat_id)
     self.external_id = str(external_id)
     self.contacts = contacts.split(',')
     self.new_msgs = int(new_msgs)
     if self.new_msgs != 0:
         print(f"in the boo if, new_msgs = {new_msgs}")
         self.new_msg_arrived()
         self.new_msgs = self.new_msgs - 1
예제 #22
0
    def __init__(self, master, level="", **kw):
        Button.__init__(self, master=master, **kw)
        self.defaultBackground = self["background"]
        # default = white

        if self["activebackground"] == "SystemButtonFace":
            self["activebackground"] = tbgc
            # default
        self["background"] = self["activebackground"]

        self["fg"] = fc
        self["font"] = f

        if self["command"] == "":
            self["command"] = lambda: MainGame(level)

        self.bind("<Enter>", self.on_enter)
        self.bind("<Leave>", self.on_leave)
예제 #23
0
 def __init__(self, string, root, iconstring, menu, view):
     self.menu = menu
     self.view = view
     if iconstring == None:
         Button.__init__(self,
                         root.interface.frame,
                         text=string,
                         command=self.onclick,
                         relief='flat')
     else:
         self.icon = PhotoImage(file=iconstring)
         Button.__init__(self,
                         root.interface.frame,
                         compound="right",
                         image=self.icon,
                         text=string,
                         command=self.onclick,
                         relief='flat')
     self.id = str(self)
     pass
예제 #24
0
 def __init__(
     self,
     master: Tk or Frame,
     text: "Text to appear on Button",
     bind_ent: "Button background color upon entering" = 'azure',
     bind_leav: "Button background color upon leaving" = 'origin',
     height: "Any Integer; Self-explanitory" = 1,
     width: "Any Integer; Self-explanitory" = 20,
     relief: "How the button looks on the window" = 'flat',
     borderwidth: "Any Integer; Self-explanitory" = 0,
     font: "Format: (Font-family, Font-size)" = ('Papyrus', 40)):
     ## Init ##
     Button.__init__(self,
                     master,
                     text=text,
                     height=height,
                     width=width,
                     relief=relief,
                     borderwidth=borderwidth,
                     font=font)
     self.colors = (bind_ent, bind_leav)
     ## Init ##
     ## Bindings ##
     self._hover(self)
예제 #25
0
 def __init__(self, *args, **kwargs):
     Button.__init__(self, *args, **kwargs)
     self.operator = kwargs['text']
예제 #26
0
 def __init__(self, master, **kw):
     Button.__init__(self, master=master, **kw)
     self.defaultBackground = self["background"]
     self.bind("<Enter>", self.on_enter)
     self.bind("<Leave>", self.on_leave)
예제 #27
0
 def __init__(self, root, **kw):
     Button.__init__(self, root, command=self.switch, **kw)
예제 #28
0
 def __init__(self, labels=0, parent=None, **configs):
     Button.__init__(self, parent, **configs)
     self.config(text='New Window!', command=self.__call__)
     self.config(bg='green', fg='yellow', padx=10, pady=2, cursor='hand2')
     self.pack(expand=YES, fill=BOTH)
     self.labels = labels
예제 #29
0
 def __init__(self, master, row, column):
     Button.__init__(self, master)
     self.row = row
     self.column = column
예제 #30
0
 def __init__(self, *args, **kwargs):
     Button.__init__(self, *args, **kwargs)
     self.value = kwargs['text']
예제 #31
0
 def __init__(self, parent=None, **kwargs):
     Button.__init__(self, parent, **kwargs)
예제 #32
0
    def __init__(self, *args, **kwargs):
        Button.__init__(self, *args, **kwargs)

        self.__configure()
예제 #33
0
 def __init__(self, root, text="", width="", height="", value=""):
     Button.__init__(self, root, text=text, width=width, height=height)
     self.value = value
예제 #34
0
    def __init__(self, master, label, function_callbak):
        Button.__init__(self, master)
        self._nom_fn_callback = function_callbak
        self._label = label

        self.config(text=self._label, command=self._nom_fn_callback)
예제 #35
0
 def __init__(self, master, command, file_name):
     Button.__init__(self, master, bg="SkyBlue4", command=command, activebackground="midnight blue", border=5)
     image = PhotoImage(file=file_name).subsample(x=4, y=4)
     self.configure(image=image)
     self.image = image