How to use the pygubu.builder.tkstdwidgets.TKToplevel 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 / pygubu / builder / tkstdwidgets.py View on Github external
if value in ('both', 'horizontally'):
                target_widget.columnconfigure(0, weight=1)
            if value in ('both', 'vertically'):
                target_widget.rowconfigure(0, weight=1)
        elif pname == 'maxsize':
            if '|' in value:
                w, h = value.split('|')
                target_widget.maxsize(w, h)
        elif pname == 'minsize':
            if '|' in value:
                w, h = value.split('|')
                target_widget.minsize(w, h)
        else:
            super(TKToplevel, self)._set_property(target_widget, pname, value)

register_widget('tk.Toplevel', TKToplevel,
                'Toplevel', ('Containers', 'tk', 'ttk'))


class TKFrame(BuilderObject):
    OPTIONS_STANDARD = ('borderwidth', 'cursor', 'highlightbackground',
                        'highlightcolor', 'highlightthickness',
                        'padx', 'pady', 'relief', 'takefocus')
    OPTIONS_SPECIFIC = ('background',  'class_', 'container',
                        'height', 'width')
    class_ = tk.Frame
    container = True
    properties = OPTIONS_STANDARD + OPTIONS_SPECIFIC

register_widget('tk.Frame', TKFrame, 'Frame', ('Containers', 'tk'))
github alejandroautalan / pygubu / pygubudesigner / widgets / toplevelframe.py View on Github external
resizable = self.tl_attrs.get('resizable', None)
                if resizable and not TKToplevel.RESIZABLE[resizable][1]:
                    remove = True
            if remove:
#                print('rm', key, value)
                cnf.pop(key)
            else:
                self._h_set = True
        return tk.Frame.configure(self, cnf)


class ToplevelFramePreviewBO(BuilderObject):
    class_ = ToplevelFramePreview
    container = True
    #Add fake 'modal' property for Dialog preview
    properties = TKToplevel.properties + ('modal',)

    def _set_property(self, target_widget, pname, value):
        tw = target_widget
        tw.tl_attrs[pname] = value
        method_props = ('overrideredirect', 'title')
        if pname in method_props:
            pass
        elif pname in ('maxsize', 'minsize'):
            if not value:
                del tw.tl_attrs[pname]
            elif '|' in value:
                w, h = value.split('|')
                if w and h:
                    tw.tl_attrs[pname] = (int(w), int(h))
                else:
                    del tw.tl_attrs[pname]
github alejandroautalan / pygubu / pygubu / builder / tkstdwidgets.py View on Github external
elif pname == 'resizable' and value:
            target_widget.resizable(*self.RESIZABLE[value])
            if value in ('both', 'horizontally'):
                target_widget.columnconfigure(0, weight=1)
            if value in ('both', 'vertically'):
                target_widget.rowconfigure(0, weight=1)
        elif pname == 'maxsize':
            if '|' in value:
                w, h = value.split('|')
                target_widget.maxsize(w, h)
        elif pname == 'minsize':
            if '|' in value:
                w, h = value.split('|')
                target_widget.minsize(w, h)
        else:
            super(TKToplevel, self)._set_property(target_widget, pname, value)
github alejandroautalan / pygubu / pygubudesigner / widgets / toplevelframe.py View on Github external
else:
                self._w_set = True
        key = 'height'
        if key in cnf:
            value = int(cnf[key])
            minsize = self.tl_attrs.get('minsize', None)
            maxsize = self.tl_attrs.get('maxsize', None)
#            print(value, minsize, maxsize)
            remove = False
            if minsize and value < minsize[1]:
                remove = True
            if maxsize and value > maxsize[1]:
                remove = True
            if self._h_set:
                resizable = self.tl_attrs.get('resizable', None)
                if resizable and not TKToplevel.RESIZABLE[resizable][1]:
                    remove = True
            if remove:
#                print('rm', key, value)
                cnf.pop(key)
            else:
                self._h_set = True
        return tk.Frame.configure(self, cnf)
github alejandroautalan / pygubu / pygubu / builder / widgets / dialog.py View on Github external
# encoding: utf8
from __future__ import unicode_literals
from pygubu.builder.builderobject import *
from pygubu.builder.tkstdwidgets import TKToplevel
from pygubu.widgets.dialog import Dialog


class DialogBO(TKToplevel):
    class_ = Dialog
    OPTIONS_STANDARD = TKToplevel.OPTIONS_STANDARD
    OPTIONS_SPECIFIC = TKToplevel.OPTIONS_SPECIFIC
    OPTIONS_CUSTOM = \
        TKToplevel.OPTIONS_CUSTOM + ('modal',)
    properties = OPTIONS_STANDARD + OPTIONS_SPECIFIC + OPTIONS_CUSTOM

    def realize(self, parent):
        BuilderObject.realize(self, parent)

    def _set_property(self, target_widget, pname, value):
        if pname == 'modal':
            modal = False
            value = value.lower()
            if value == 'true':
                modal = True
            self.widget.set_modal(modal)
        else:
            super(DialogBO, self)._set_property(
github alejandroautalan / pygubu / pygubu / builder / widgets / dialog.py View on Github external
# encoding: utf8
from __future__ import unicode_literals
from pygubu.builder.builderobject import *
from pygubu.builder.tkstdwidgets import TKToplevel
from pygubu.widgets.dialog import Dialog


class DialogBO(TKToplevel):
    class_ = Dialog
    OPTIONS_STANDARD = TKToplevel.OPTIONS_STANDARD
    OPTIONS_SPECIFIC = TKToplevel.OPTIONS_SPECIFIC
    OPTIONS_CUSTOM = \
        TKToplevel.OPTIONS_CUSTOM + ('modal',)
    properties = OPTIONS_STANDARD + OPTIONS_SPECIFIC + OPTIONS_CUSTOM

    def realize(self, parent):
        BuilderObject.realize(self, parent)

    def _set_property(self, target_widget, pname, value):
        if pname == 'modal':
            modal = False
            value = value.lower()
            if value == 'true':
                modal = True
github alejandroautalan / pygubu / pygubudesigner / widgets / toplevelframe.py View on Github external
cnf = tk._cnfmerge(cnf)
        key = 'width'
        if key in cnf:
            value = int(cnf[key])
            minsize = self.tl_attrs.get('minsize', None)
            maxsize = self.tl_attrs.get('maxsize', None)
#            print(value, minsize, maxsize)
            remove = False
#            print('tl_attrs:', self.tl_attrs)
            if minsize and value < minsize[0]:
                remove = True
            if maxsize and value > maxsize[0]:
                remove = True
            if self._w_set:
                resizable = self.tl_attrs.get('resizable', None)
                if resizable and not TKToplevel.RESIZABLE[resizable][0]:
                    remove = True
            if remove:
#                print('rm', key, value)
                cnf.pop(key)
            else:
                self._w_set = True
        key = 'height'
        if key in cnf:
            value = int(cnf[key])
            minsize = self.tl_attrs.get('minsize', None)
            maxsize = self.tl_attrs.get('maxsize', None)
#            print(value, minsize, maxsize)
            remove = False
            if minsize and value < minsize[1]:
                remove = True
            if maxsize and value > maxsize[1]: