Custom

Purpose

A custom widget allows you to use other Tkinter widgets not supported in GUI Pie, but still allows you to access GUI Pie's widget positioning system. This means that GUI Pie will handle placing the widget on the grid, and will support hiding and showing the widget if used in a group. GUI Pie can also optionally handle text wrapping as well.

If you are working with Groups, or resizable windows, Custom widgets will be highly beneficial as opposed to writing additional code yourself.

Properties

  • Title - the name of this widget in the code. To access an image in the code - to edit it or retrieve from it - it is referenced by
    <gui name>.<imageName>. For a GUI named gui, and a widget named Custom1, this would be gui.Custom1.
    This title therefore must be unique to the widget.

  • Object definition - this is the definition of the widget object with all of its properties as parameters, as you would define it in Tkinter. You can omit the root window parameter or explicitly provide it by writing {root}. An example for a Label is Label(text = 'Custom Object', font = ('Arial', 16), width = 1, height = 1, fg = '#000000', bg = '#55FF55').

  • For widgets which support the height and width parameters, the recommended values for these are 1 for each.

  • Wrap text - for widgets which support text wrapping, GUI Pie will handle text wrapping for this widget. Do not use on widgets which do not support text wrapping.

  • To reference the name of the root window, use the {root} keyword. GUI Pie will replace this with the name of window when creating the file.

A custom widget will often have to be supported by additional code. This can be placed in the More Code section. The code for custom widgets is placed at the bottom of the file, below the 'More Code' section.

CAUTION - any errors written in your custom widget definition will lead to errors in the final exported window. This could lead to your window not being able to run. Ensure all custom widgets are syntactically correct.