Example #1
0
# encoding: utf8
from pygubu import BuilderObject, register_widget, register_property
from pygubu.builder.ttkstdwidgets import TTKCombobox
from pygubu.widgets.combobox import Combobox


class ComboboxBuilder(TTKCombobox):
    OPTIONS_SPECIFIC = tuple(set(TTKCombobox.OPTIONS_SPECIFIC) - set(('state',)))
    OPTIONS_CUSTOM = TTKCombobox.OPTIONS_CUSTOM + ('keyvariable',)
    properties = (TTKCombobox.OPTIONS_STANDARD + TTKCombobox.OPTIONS_SPECIFIC +
                  OPTIONS_CUSTOM)
    tkvar_properties = TTKCombobox.tkvar_properties + ('keyvariable',)
    class_ = Combobox

register_widget('pygubu.builder.widgets.combobox', ComboboxBuilder, 'Combobox',
                ('ttk', 'Pygubu Widgets'))

props = {
    'keyvariable': {
        'editor': 'tkvarentry'
        }
    }

for p in props:
    register_property(p, props[p])
Example #2
0
class PathChooserInputBuilder(BuilderObject):
    class_ = PathChooserInput
    OPTIONS_CUSTOM = ('type', 'path', 'image', 'textvariable')
    properties = OPTIONS_CUSTOM

register_widget('pygubu.builder.widgets.pathchooserinput', PathChooserInputBuilder,
                'PathChooserInput', ('ttk', 'Pygubu Widgets'))

props = {
    'type': {
        'editor': 'choice',
        'params': {
            'values': (PathChooserInput.FILE, PathChooserInput.DIR), 'state': 'readonly'},
        'default': PathChooserInput.FILE
        },
    'path': {
        'editor': 'entry'
        },
    'image': {
        'editor': 'imageentry'
        },
    'textvariable': {
        'editor': 'tkvarentry'
        }
    }

for p in props:
    register_property(p, props[p])