How to use the pygubu.stockimage.StockImage.get function in pygubu

To help you get started, we’ve selected a few pygubu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alejandroautalan / pygubu / pygubudesigner / main.py View on Github external
#Start building widget tree selector
        roots = {}
        sections = {}
        for key, wc in treelist:
            root, section = key.split('>')
            #insert root
            if root not in roots:
                roots[root] = widgetlisttv.insert('', 'end', text=root)
            #insert section
            if key not in sections:
                sections[key] = widgetlisttv.insert(roots[root], 'end', text=section)
            #insert widget
            w_image = default_image
            try:
                w_image = StockImage.get('22x22-{0}'.format(wc.classname))
            except StockImageException as e:
                pass
            
            widgetlisttv.insert(sections[key], 'end', text=wc.label,
                image=w_image, tags='widget', values=(wc.classname,))
        widgetlisttv.tag_bind('widget', '', self.on_widgetlist_dclick)

        #Expand prefered widget set
        hidews = 'tk'
        prefws = get_option('widget_set')
        if hidews == prefws:
            hidews = 'ttk'
        widgetlisttv.item(roots[hidews], open=False)
        widgetlisttv.item(roots[prefws], open=True)
        for child in widgetlisttv.get_children(roots[prefws]):
            widgetlisttv.item(child, open=True)
github alejandroautalan / pygubu / pygubudesigner / main.py View on Github external
if root not in roots:
                roots[root] = acf.add_group(root, root)
            #insert section
            if key not in sections:
                sectionacf = AccordionFrame(roots[root])
                sectionacf.grid(sticky=tk.NSEW, padx='5 0')
                sectionacf.bind('<>',
                                self.on_widgetlist_group_toogle)
                sectiongrp = sectionacf.add_group(key, section)
                sections[key] = AutoArrangeFrame(sectiongrp)
                sections[key].grid(sticky=tk.NSEW)

            #insert widget
            w_image = default_image
            try:
                w_image = StockImage.get('22x22-{0}'.format(wc.classname))
            except StockImageException as e:
                pass

            #define callback for button
            def create_cb(cname):
                return lambda: self.on_add_widget_event(cname)

            b = ttk.Button(sections[key], text=wc.label, image=w_image,
                           style='Toolbutton', command=create_cb(wc.classname))
            tooltip.create(b, wc.classname)
            b.grid()

        #Expand prefered widget set
        hidews = 'tk'
        prefws = get_option('widget_set')
        if hidews == prefws:
github alejandroautalan / pygubu / pygubudesigner / widgets / fontentry.py View on Github external
w.parameters(width=4)
        w.grid(row=0, column=1, sticky='w')
        w.bind('<>', self._on_variable_changed)

        w = ttk.Label(container1, text='style:', font='TkSmallCaptionFont')
        w.grid(row=0, column=2, sticky='w', padx=5)

        self._bold = w = CheckbuttonPropertyEditor(container1)
        img = StockImage.get('format-text-bold')
        w.parameters(style='Toolbutton', text='B', image=img,
                     onvalue='bold', offvalue='')
        w.grid(row=0, column=3, sticky='we')
        w.bind('<>', self._on_variable_changed)

        self._italic = w = CheckbuttonPropertyEditor(container1)
        img = StockImage.get('format-text-italic')
        w.parameters(style='Toolbutton', text='I', image=img,
                     onvalue='italic', offvalue='')
        w.grid(row=0, column=4, sticky='we')
        w.bind('<>', self._on_variable_changed)

        self._underline = w = CheckbuttonPropertyEditor(container1)
        img = StockImage.get('format-text-underline')
        w.parameters(style='Toolbutton', text='U', image=img,
                     onvalue='underline', offvalue='')
        w.grid(row=0, column=5, sticky='we')
        w.bind('<>', self._on_variable_changed)

        self._overstrike = w = CheckbuttonPropertyEditor(container1)
        img = StockImage.get('format-text-strikethrough')
        w.parameters(style='Toolbutton', text='S', image=img,
                     onvalue='overstrike', offvalue='')
github alejandroautalan / pygubu / pygubudesigner / main.py View on Github external
def _setup_styles(self):
        s = ttk.Style()
        s.configure('ColorSelectorButton.Toolbutton',
                    image=StockImage.get('mglass'))
        s.configure('ImageSelectorButton.Toolbutton',
                    image=StockImage.get('mglass'))
        if sys.platform == 'linux':
            #change background of comboboxes
            color = s.lookup('TEntry', 'fieldbackground')
            s.map('TCombobox', fieldbackground=[('readonly', color)])
            s.map('TSpinbox', fieldbackground=[('readonly', color)])