示例#1
0
    def iniciar(self, master: object) -> None:
        if 'fz' in self.defs.mcnf:
            fonte = self.defs.cnf['font']
            self.defs.cnf['font'] = (fonte[0], self.defs.mcnf['fz'], fonte[2])

        Label.__init__(self, master=master, cnf=self.defs.cnf)
        self.mostrar()
示例#2
0
 def __init__(self, parent, group, **kw):
     self._group = group
     kw['text'] = str(group)
     #        kw.setdefault('anchor', 'w')
     kw.setdefault('font', Font(size=20))
     Label.__init__(self, parent, **kw)
     self._init_menu()
示例#3
0
文件: gui.py 项目: RoaldL/photobooth
    def __init__(self, master, filename, delay):
        im = Image.open(filename)
        seq =  []
        try:
            while 1:
                seq.append(im.copy())
                im.seek(len(seq)) # skip to next frame
        except EOFError:
            pass # we're done

        try:
            self.delay = delay
        except KeyError:
            self.delay = 100

        first = seq[0].convert('RGBA')
        self.frames = [ImageTk.PhotoImage(first)]

        Label.__init__(self, master, image=self.frames[0])

        temp = seq[0]
        for image in seq[1:]:
            temp.paste(image)
            frame = temp.convert('RGBA')
            self.frames.append(ImageTk.PhotoImage(frame))

        self.idx = 0

        self.cancel = self.after(self.delay, self.play)
示例#4
0
    def __init__(self, master, text, background=None, font=None, familiy=None, size=None, underline=True, visited_fg = "#551A8B", normal_fg = "#0000EE", visited=False, action=None):
        self._visited_fg = visited_fg
        self._normal_fg = normal_fg
        
        if visited:
            fg = self._visited_fg
        else:
            fg = self._normal_fg

        if font is None:
            default_font = nametofont("TkDefaultFont")
            family = default_font.cget("family")

            if size is None:
                size = default_font.cget("size")

            font = Font(family=family, size=size, underline=underline)

        tkLabel.__init__(self, master, text=text, fg=fg, cursor="hand2", font=font)

        if background is None:
            background = get_background_of_widget(master)

        self.configure(background=background)

        self._visited = visited
        self._action = action

        self.bind("<Button-1>", self._on_click)
示例#5
0
    def __init__(self, master: Any, text: str = '', command: (Callable, None) = None, color: str = 'default',
                 disabled: bool = False, *args: Any, **kwargs: Any):
        """

        :param Any master: The parent Window where the widget will be placed on.
        :param str text: The text of the button.
        :param command: A function to be trigger when the button is pressed.
        :type command: Callable or None
        :param str color: The available colors are - cloud, info, primary, danger, warning, success, elegant and default
        :param bool disabled: If the button is disabled it does not respond to click and it must be a bool value.
        :param Any args: Any extra arguments.
        :param Any kwargs: Any extra keyword arguments.
        """
        Label.__init__(self, master, text=text, padx=14, pady=6, font=('Verdana', 12), relief=FLAT, *args, **kwargs)
        self.disabled = disabled
        self.colors = theme.btn_color

        if color not in self.colors:
            color = 'default'

        self.on_hover_color = self.colors[color]['on_hover']
        if not disabled:
            self.background_color = self.colors[color]['background']
            self.foreground_color = self.colors[color]['foreground']
            self.bind('<Enter>', self.on_hover)
            self.bind('<Leave>', self.off_hover)
            self.bind('<Button-1>', lambda event: self.on_click(command))
        elif disabled:
            self.background_color = self.colors[color]['disabled_bg']
            self.foreground_color = self.colors[color]['disabled_fg']

        self.off_hover()
    def __init__(self, parent, text, relx, rely):
        self.parent, self.text, self.relx, self.rely = parent, text, relx, rely

        Label.__init__(self, self.parent)

        self.configure_()
        self.place_()
示例#7
0
    def __init__(self, *args, **kwargs):
        self.command = kwargs.pop("command") if kwargs.get("command") else None
        self.image = kwargs.pop("image") if kwargs.get("image") else None

        Label.__init__(self, *args, **kwargs)
        # self.configure(background = "#888888")
        self.bind('<Button-1>', self.on_click)
        self.set_image(self.image)
 def __init__(self, master, pos, *args, **kwargs):
     '''
     pos should be a Position Object
     '''
     Label.__init__(self, master, *args, **kwargs)
     self.id = Widget.classCounter
     Widget.classCounter += 1
     self.position = pos
示例#9
0
 def __init__(self, master, *args, **kwargs):
     _Label.__init__(self,
                     master,
                     font=('Verdana', 12),
                     bg=theme.app_color['background'],
                     fg=theme.app_color['foreground'],
                     *args,
                     **kwargs)
示例#10
0
 def __init__(self, x, y, space):
     self.space = space
     self.bullet_timer = 0.01
     self.bullet_indicator = "'"
     self.damage = -100
     Label.__init__(self, text=self.bullet_indicator)
     self.pack()
     self._x = x
     self._y = y
     self._observers = []
示例#11
0
    def __init__(self, master, im):

        if im.mode == "1":
            # bitmap image
            self.image = ImageTk.BitmapImage(im, foreground="white")
            Label.__init__(self, master, image=self.image, bg="black", bd=0)

        else:
            # photo image
            self.image = ImageTk.PhotoImage(im)
            Label.__init__(self, master, image=self.image, bd=0)
示例#12
0
    def __init__(self, parent, hand, cardImages, card=None):

        '''Initializes a card place.'''

        Label.__init__(self, parent)
        self.bind('<Button-1>', self.flip)
        self.hand = hand
        self.cardImages = cardImages
        self.flippable = True

        self.place(card)
示例#13
0
    def __init__(self, master, im):

        if im.mode == "1":
            # bitmap image
            self.image = ImageTk.BitmapImage(im, foreground="white")
            Label.__init__(self, master, image=self.image, bg="black", bd=0)

        else:
            # photo image
            self.image = ImageTk.PhotoImage(im)
            Label.__init__(self, master, image=self.image, bd=0)
示例#14
0
    def __init__(self, master, destination=None, text=None):
        Label.__init__(
                self, master, text=(text or destination or ''),
                foreground='#0000ff')
        modify_font(self, underline=True)

        self.destination = destination

        self.bind('<1>', self.click_link)
        self.bind('<Enter>', self._enter)
        self.bind('<Leave>', self._leave)
示例#15
0
 def __init__(self, root, *args, **kwargs):
     load = Image.open(resource_path('assets/logo.png'))
     load = load.resize((50, 50))
     self.render = ImageTk.PhotoImage(load)
     Label.__init__(self,
                    root,
                    padx=5,
                    pady=5,
                    image=self.render,
                    *args,
                    **kwargs)
示例#16
0
 def __init__(self, parent, file, frames):
     Label.__init__(self, parent)
     self.parent = parent
     self._frames = [
         PhotoImage(file=file, format='gif -index %i' % i)
         for i in range(frames)
     ]
     self.config(image=self._frames[-1])
     self._current_frame = 0
     self.visible = False
     self._tk_loop = self.parent.after(0, lambda: None)
示例#17
0
    def __init__(self, parent: Widget, string_var: StringVar, *args, **kwargs):
        """Parent widget and string var are required.

        Args:
            parent: parent frame menubutton belongs to
            string_var: must be set a name in Images.
        """
        Label.__init__(self, parent, *args, **kwargs)
        self.__string_var = string_var
        self.__string_var.trace("w", self.__trace_callback)
        name = string_var.get()
        self.config(image=Images[name])
示例#18
0
    def __init__(self, master, destination=None, text=None):
        Label.__init__(self,
                       master,
                       text=(text or destination or ''),
                       foreground='#0000ff')
        modify_font(self, underline=True)

        self.destination = destination

        self.bind('<1>', self.click_link)
        self.bind('<Enter>', self._enter)
        self.bind('<Leave>', self._leave)
示例#19
0
	def __init__(self,frame,text="",font=style.smalltext,text_variable=None,background = style.primary_color,foreground=style.lg,anchor="w",wraplength = None):
		Label.__init__(self,frame,
			background = background,
			highlightthickness=0,
			anchor=anchor,
			text = text,
			font=font,
			foreground= foreground,
			textvariable = text_variable,
			)
		if not wraplength == None:
			self.configure(wraplength=wraplength)
示例#20
0
 def __init__(self,
              frame,
              text=None,
              borderwidth=2,
              relief="raised",
              controller=None):
     Label.__init__(self,
                    frame,
                    text=text,
                    borderwidth=borderwidth,
                    relief=relief)
     self.controller = controller
示例#21
0
    def __init__(self, parent, integer=Integer(), **kw):
        #kw['state'] = 'disabled'
        kw.setdefault('anchor', 'nw')
        kw.setdefault('relief', 'sunken')

        kw.setdefault('width', 10)
        kw.setdefault('justify', 'left')
        self._var = StringVar()
        Label.__init__(self, parent, textvariable=self._var, **kw)
        self._factorization_enabled = False
        self.integer = integer
        self.bind("<Configure>", self._update_width)

        self._init_menu()
示例#22
0
    def __init__(self, pmaster, ptext=None, pstyle="DEFAULT"):
        """
		Initialization Function
		:param pmaster: Master Frame
		:param ptext: Text to display on label
		:param pstyle: User-defined style or default as string
		"""
        Label.__init__(self, pmaster)
        self.config(text=ptext)

        try:
            self.avklConfigure(AVKLabelStyles[pstyle])
        except KeyError:
            raise AVKLabel.InvalidAVKLabelTypeError(pstyle)
示例#23
0
 def __init__(self, space):
     self.ship_indicator = "."
     Label.__init__(self, text=self.ship_indicator)
     # initial coordinates
     self.space = space
     self.x = space.width / 2
     self.y = space.height / 2
     self.pack()
     self.place_ship()
     self._observers = []
     self._bullets = set()
     self._enemies = set()
     self._bullet_count = 0
     self._life = 0
     self.enemy_generator()
示例#24
0
 def __init__(self, parent, name, maxheight, **kwargs):
     images = glob(path.join(getcwd(), 'images', 'products', f"{name}.png"))
     if not len(images):
         images = glob(
             path.join(getcwd(), 'images', 'products', 'big',
                       f"{name}.png"))
     file = images[0] if len(images) else path.join(getcwd(), 'images',
                                                    'no_image.png')
     image = Image.open(file)
     height = image.height
     if height > maxheight + 10:
         width = (image.width * maxheight) // image.height
         image = image.resize((width, maxheight))
     self.width = image.width
     self.height = image.height
     self.img = ImageTk.PhotoImage(image)
     Label.__init__(self, parent, image=self.img, **kwargs)
示例#25
0
    def __init__(self, *args, **kwargs):
        Label.__init__(self, *args, **kwargs)

        if kwargs.get('bg', '') == '':
            self['bg'] = 'gray13'
        else:
            self['bg'] = kwargs.get('bg', '')

        if kwargs.get('fg', '') == '':
            self['fg'] = 'gray50'
        else:
            self['fg'] = kwargs.get('fg', '')

        if kwargs.get('font', '') == '':
            self['font'] = ('Helvetica', 18, "bold")
        else:
            self['font'] = kwargs.get('font', '')
示例#26
0
    def __init__(self,
                 parent,
                 width=300,
                 height=150,
                 resize='n',
                 img='imgpath',
                 bd=1,
                 relief='solid'):
        self.image, self.w, self.h = self.fl2tk(img, width, height, resize)

        Label.__init__(self,
                       parent,
                       width=self.w,
                       height=self.h,
                       image=self.image,
                       relief=relief,
                       bd=bd)
        return
示例#27
0
    def __init__(self, master, frameSize, frameId):

        self.content = 'Free'

        Label.__init__(self,
                       master,
                       height=5,
                       width=25,
                       bd=5,
                       text=self.content,
                       relief=RAISED)

        self.MaxSize = frameSize
        self.frameID = frameId
        self.free = True

        self.PID = 0
        self.pageType = ""
        self.page = 0

        self.pack(side=BOTTOM)
    def __init__(self, master, text, url, background='LightBlue', font=None, visited_fg = "#551A8B", normal_fg = "#0000EE", visited=False):
        
        self._visited_fg = visited_fg
        self._normal_fg = normal_fg
        self.url = url
        if visited:
            fg = self._visited_fg
        else:
            fg = self._normal_fg

        if font is None:
            font = Font(family="Arial", size=10, underline=True)
        
        #set up the label
        Label.__init__(self, master, text=text, fg=fg, cursor="hand2", font=font)   

        self._visited = visited
        self.configure(background=background)
        
        #make the label into a link
        self.bind("<Button-1>", self._on_click)
示例#29
0
    def __init__(
        self,
        parent: "PairSelector",
        currency: Union[Currency, str],
        color: str,
        state: str = State.OFF,
    ):
        """Initialize label with specified currency.

        Args:
            parent: parent widget
            currency: currency that label is for.
            color: theme color (visible around edges of flag images)
            state: select state to start label in
        """
        Initializer.initialize(parent.winfo_toplevel())
        Label.__init__(self, parent, padx=0, pady=0, bg=color)
        self.selector = parent
        self.currency = Currency(currency)
        self.state = state
        self.set_state(state)
        self.bind(Event.LEFT_CLICK, self.left_click_callback)
        self.bind(Event.RIGHT_CLICK, self.right_click_callback)
示例#30
0
    def __init__(self, master=None, **kw):
        self.frame = Frame(master)

        if 'height' in kw:
            del kw['height']

        if len(kw['text']) < kw['width']:
            kw['width'] = len(kw['text'])

        kw['text'] = self.prepare_text(kw['text'], kw['width'])
        Label.__init__(self, self.frame, **kw)

        self.pack(side=LEFT, fill=BOTH, expand=True)

        # Copy geometry methods of self.frame without overriding Text
        # methods -- hack!
        text_meths = vars(Label).keys()
        methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys()
        methods = methods.difference(text_meths)

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))
示例#31
0
 def __init__(self, master, **kw):
     Label.__init__(self, master=master, **kw)
     self["background"] = sbgc
     self["foreground"] = fc
     self["font"] = f
示例#32
0
 def __init__(self, parent, *args, **kwargs):
     Label.__init__(self, parent, *args, **kwargs)
     self.lastTime = ""
     t = time.localtime()
     self.zeroTime = dt.timedelta(hours=t[3], minutes=t[4], seconds=t[5])
     self.tick()
示例#33
0
    def __init__(self, parent, image, pos):
        Label.__init__(self, parent, image=image)

        self.image = image
        self.pos = pos
        self.cor_pos = pos
示例#34
0
 def __init__(self, master=None):
     Label.__init__(self, master)
     self.model = TextHolderModel(view=self)
示例#35
0
 def __init__(self, parent):
     Label.__init__(self, parent, background = "#ffffff", font = AppFont() )
示例#36
0
 def __init__(self, parent):
     Label.__init__(self, parent, background = "#ff0000", foreground = "#ffffff", justify = "center", font = AppFont() )
示例#37
0
 def __init__(self, parent):
     Label.__init__(self, parent, background = "#ffffff", foreground = "#363636", justify = "left", font = AppFont() )