QTPYGUI 1.0.4.4
A Simple Python Declarative User Interface Wrapper Around Pyside6
Requires Python: >=3.10
Keywords: pypi, cicd, pyside6, ui, gui, qt, qtpygui, declarative, wrapper, user-interface, qt-bindings, python-qt, gui-framework, ui-library, pyside6-wrapper, pyside

# QTPYGUI
### Author: David Worboys 
##### 2025-05-25 - Updated
##### Update
## Index
1. [Introduction](#introduction)
2. [Installation](#installation)
3. [Basic Concepts](#basic-concepts)
   - [Containers](#containers)
   - [GUI Controls](#gui-controls)
   - [Event Handling](#event-handling)
4. [Hello World Application](#building-your-first-application)
5. [Application Distribution](#distributing-your-application)
6. [Boot Camp](#boot-camp)
7. [QTPYGUI Control Reference](#qtpygui-control-api-reference) 
8. [QTPYGUI Enumerated Types/Classes](#qtpygui-enumerated-typesclass-reference)

## Introduction
QTPYGUI is a declarative user interface wrapper around Pyside6 and, as there are 
a number of GUI (Graphical User Interface) wrappers around various widget sets,
including Pyside6, the natural question is why another one? The answer lies in 
at least two parts, my dissatisfaction with how the other GUI wrappers were 
implemented/managed and because I could and there is much to be learned with 
that approach.

The next question the reader might find themselves asking is why not a web UI
based on the old favourites of HTML, CSS and Javascript, something like React 
perhaps? I am a firm believer in "horses for courses", so why bring a browser to
the desktop fight and all the resources, memory/compute, that entails when a 
well-designed widget set with better performance and memory usage is 
available. Worse, building web apps is a complicated business even with the
web UI frameworks, of course some may same the same of desktop widget sets, and 
this is where GUI wrappers like QTPYGUI come in.

In closing, it is worth noting that a major advantage in utilising a GUI wrapper,
aside from ease of programming, is that if the underlying widget set is 
deprecated, or licensing changes, then the GUI wrapper can change widget sets.
Although this would be a large task, the major benefit is that applications using 
the GUI wrapper will be minimally impacted.

### What Is A Declarative User Interface?
A declarative UI (user interface) is an application user interface coded in
the application source code using a formal specification. There is no need for
GUI designers, and the application programmer writes the UI as just another 
part of the code. This is an old idea, going back at least to the early 1980's
and applications like dBase II and Clipper but just because it is old does not 
mean it is bad or not relevant.

### Notes
1. Development of QTPYGUI started privately in 2020, moving to a public release in 2024.
   - This version is an early public release and doco and code streamlining is onging.
   
   - Although QTPYGUI is used in production applications, there are bound to be bugs, 
   certainly Dateedit and Treeview need much more work as they are infrequently 
   used.
    
   - The feature set of other GUI components needs to be widened. Missing also is
   theming and this will be required for a larger audience.

2. **HELP IS WANTED AND I WELCOME ALL CONTRIBUTIONS!**

    - Please reach out to me via Discussions (https://github.com/David-Worboys/QTPYGUI/discussions)
    if you want to help or have ideas on improvements
   
    - Bugs can be logged at https://github.com/David-Worboys/QTPYGUI/issues  

3. QTPYGUI will always remain opensource, unlike some other similar frameworks
   that used "bait and switch" tactics

4. QTPYGUI uses Python 3.13 for development and ruff (https://github.com/astral-sh/ruff)
for formatting. Type hinting is mandatory as are asserts to check all arguments to 
functions/methods

5. My time is limited (both figuratively and literally), but I will put in as 
much effort as I can to help move things along

6. I strongly suggest using Nutika (https://nuitka.net/) to distribute your 
Python desktop applications. I use this method exclusively with great success.

7. Finally, to the reader's relief, I only use Linx Mint for development and 
do not have access to a Windows installation, and therefore

   - ***HELP IS Neeeded 
   To Verify QTPYGUI's Operations Under Windows***


### Where To Find An Application That Uses QTPYGUI?
https://github.com/David-Worboys/Black-DVD-Archiver



## QTPYGUI 101
First up, QTPYGUI is pronounced "Cutey Pie GUI" which follows the "QT Groups"
own pronunciation and appeals to my, admitably lame, sense of humour.
### Prerequities
1. Python version >= 3.9, Recommended >= 3.12 
   - Nuitka now works with Python 3.13.
### Installation
1. Create your Python project folder and set up your Python project using 
the virtual environment manager of your choice

2. pip install QTPYGUI

### Boot Camp
First up, check out the examples in https://github.com/David-Worboys/QTPYGUI/tree/master/examples .
There is one example per python source file, and I will be adding more as time 
progresses.

#### Basic Concepts
1. QTPYGUI is event driven and there are no "busy" loops waiting for something
to happen

2. By default, width and height settings are in characters
   - Pixels can be used as an argument is provided to allow for this
   - This works best with monospaced fonts
   
   - The default font is "IBM Plex Mono" and the default font size is 10
     - This is included in the installation of QTPYGUI 
     - If this font is missing, then QTPYGUI will try and find a system font that 
     will work

3. The basic structure of a QTPY GUI Program is as follows:

```
import QTPYGUI.qtpygui as qtg

Class Example_App
    def __init__(self):
        """ Setup application instance variable """
        self.example_app = qtg.QtPyApp(
            display_name="Example App",
            callback=self.event_handler,
            height=100,
            width=100,
        ) 
    
    def event_handler(self, event: qtg.Action):
        """Handles  events"""
    
    def layout()-> qtg.VBoxContainer:
        """ Defines The User Interface Layout """
    
    def run(self):
        """Run Example App"""
        self.example_app.run(layout=self.layout())
        
if __name__ == "__main__":
    example_app = Example_App()
    example_app.run()            
        
```
1. This defines the structure of the application main.py file

2. https://github.com/David-Worboys/QTPYGUI/blob/master/examples/example_01.py
shows this in action.

3. The python classes that utilise a GUI are defined as below:
```
import QTPYGUI.qtpygui as qtg

Class Example_Class:
    def event_handler(self, event: qtg.Action):
        """Handles  events"""
        
    def layout()-> qtg.VBoxContainer:
        """ Defines The User Interface Layout """    

```
1. When the Example_Class is instantiated, the layout method is called to 
generate the GUI elements of the display and this is assigned to the calling 
window/GUI object

##### Containers
Containers are at the heart of the QTPYGUI system and define the layout of the 
GUI items. The following are four types of containers:

- FormContainer
  - Lays out [GUI Controls](#gui-controls-1) vertically as per the associated platform (Linux, 
  Windows, Mac) GUI specifications
- HBoxContainer
  - Lays out the [GUI Controls](#gui-controls-1) horizontally 
  
- VBoxContainer
  - Lays out the [GUI Controls](#gui-controls-1) vertically, similar to the FormContainer but does
  not adhere as tightly to the associated platform specifications
  
- GridContainer
  - Lays out the [GUI Controls](#gui-controls-1) as a grid.  This container is seldom used.

To add a GUI control to a container, the ```add_row``` method is used as below:

```
qtg.HBoxContainer(tag="button_example").add_row(
                qtg.Button(
                    tag="example_1", text="Example 1", callback=self.event_handler, width=10
                ),
                qtg.Button(
                    tag="example_2", text="Example 2", callback=self.event_handler, width=10
                ),
)                
```
- This will lay out two Buttons Horizontally. If a FormContainer or a VBoxContainer
was used, the buttons would be laid out vertically.

- **Note the use of the tag, text and callback arguments as these are fundamental
to the operation of QTPYGUI [GUI Controls](#gui-controls)**
  - If a Container has a text argument, it becomes a Group box.

##### GUI Controls
These are the GUI components that comprise the UI of an application. Declaring them
utilises a standard pattern of arguments with additional arguments for specific
[GUI Controls](#gui-controls-1).

**Note: If an argument is not supported by a GUI control, it is ignored.**

Let us consider the Button GUI control

````commandline
qtg.Button(tag="example_1", text="Example 1",label="Click Me!", callback=self.event_handler)
````
**Note: The following arguments are common to all QTPYGUI controls**

"tag" — The "tag" is the name of the control, as it is housed in a container 
then the container "tag" and the button "tag" make a unique pair.
- This makes it easier to code larger applications as each GUI element 
  does not have to have a unique name.
  
- If a "tag" is not provided, then the application generates one automatically.
  - This is fine for "Container" and "Label" objects where the programmer does 
  not intend to reference an object. 
  
"text" — The "text" is the text displayed on the control, it is optional

"label" — The "label" argument places a label to the left of the control, it is
optional

"callback" — Is the name of the method that will process the events generated
by the GUI control. By convention, I declare this as the "event_handler" method. 

- If a callback method is not provided, then the control cannot send events to it

- The "event_handler" method takes only one argument—the [Action](#action) 
instance whose properties and methods are at the heart of QTPYGUI programming 
    
    


##### Event Handling
The burning question in the reader's mind is what happens when an operation occurs
on a GUI control, say if a Button (as defined below) is clicked on:
```
qtg.Button(tag="example_2", text="Example 2", callback=self.event_handler, width=10),
```
The answer is that the ```callback``` method ```self.event_handler``` is triggered 
with a CLICKED event, and it can be processed as below:

```
    def event_handler(self, event: qtg.Action):
        """Handles  form events
        Args:
            event (qtg.Action): The triggering event
        """
        assert isinstance(self,event:qtg.Action), f"{event=}. Must be Action"

        match event.event:
            case qtg.Sys_Events.CLICKED:
                match event.tag:                    
                    case "example_2":
                        popups.PopMessage(title="Hi", message="Example 2 Was Clicked").show()
```
This results in a Pop-up window opening with a title of "Hi" displaying
"Example 2 Was Clicked" 

**Note: This is the essence of event driven programming, nothing happens until an
event is triggered, mostly by the application[GUI Controls](#gui-controls-1) - like Buttons.**

The observant reader may notice the event instance passed to the ```event handler``` 
is a class of [Action](#action) which probably should have been named 
```Event``` but for historical reasons that nomenclature is staying. 

The [Action](#action) class has a number of very useful methods and properties, and 
a programmer using QTPYGUI will become very familiar with them.

#### Building Your First Application:

As is traditional, a "hello world" program needs to be written first, so let's 
get to it!

```
import QTPYGUI.qtpygui as qtg

class Hello_World:
    def __init__(self):
        self.hello_world = qtg.QtPyApp(
            display_name="Hello World",
            callback=self.event_handler,
            height=100,
            width=100,
        )

    def event_handler(self, event: qtg.Action):
        """Handles  form events
        Args:
            event (qtg.Action): The triggering event
        """
        assert isinstance(event, qtg.Action), f"{event=}. Must be Action"

        match event.event:
            case qtg.Sys_Events.CLICKED:
                match event.tag:
                    case "ok":
                        self.hello_world.app_exit()

    def layout(self) -> qtg.VBoxContainer:
        """The layout of the window
        Returns:
            qtg.VBoxContainer: The layout
        """
        return qtg.VBoxContainer(align=qtg.Align.BOTTOMRIGHT).add_row(
            qtg.FormContainer().add_row(
                qtg.Label(
                    text="Hello World!",
                    txt_fontsize=48,
                    txt_align=qtg.Align.CENTER,
                    txt_font=qtg.Font(backcolor="blue", forecolor="yellow"),
                ),
            ),
            qtg.HBoxContainer().add_row(
                qtg.Button(
                    tag="ok",
                    text="OK",
                    callback=self.event_handler,
                    width=10,
                    tooltip="Exit Example 01",
                ),
            ),
        )

    def run(self):
        """Run example_01"""
        self.hello_world.run(layout=self.layout())

if __name__ == "__main__":
    hello_world = Hello_World()
    hello_world.run()
```

This is a slightly simplified version of example_01.

Copy the above source code into a hello_world.py file and run it like so:

```python3 -OO hello_world.py```

And the follwing screen will be displayed:
<br><br>![](./userguide_images/hello_world.png)

#### Distributing Your Application
I strongly recommend using Nuitka (https://nuitka.net/) to distribute your 
program as it can produce a single compiled file, housing all dependencies 
that can be copied to a host machine. 

Nuitka's Kay Hayen is simply the Python GOAT when it comes to this type of thing.

To compile ```hello_world.py``` the reader will need to install Nuitka

```pip install Nuitka```

and run this command:
```
python -m nuitka                                                                            \
--show-anti-bloat-changes                                                                   \
--assume-yes-for-downloads                                                                  \
--lto=yes                                                                                   \
--python-flag=-OO                                                                           \
--python-flag=no_warnings                                                                   \
--python-flag=isolated                                                                      \
--standalone                                                                                \
--onefile                                                                                   \
--prefer-source-code                                                                        \
--enable-plugin=pyside6                                                                     \
--include-qt-plugins=sensible                                                               \
--include-package-data=QTPYGUI                                                              \
hello_world.py
```
This will produce a ```hello_world.bin``` file on Linux, double-click on it and 
the ```hello_world``` application will start.

Note:
1. On occasion the ```hello_world.bin``` file will need to be made executable, and this
is done as follows:

- Right-click on the ```hello_world.bin``` file and select "Properties." This 
will open the file properties window. select  "Permissions" and tick "Allow 
executing file as program" and then "Close"

2. At the time of writing, this will produce a 58MB ```hello_world.bin``` 
executable file - This is simply how it is when distributing Python applications
 as so much is included during the build process. It is worth noting that 
PyInstaller produces even larger executables! 

## QTPYGUI Control API Reference

This section details the wide variety of GUI (Graphical User Interface) controls 
that are available to design a user interface (UI) with QTPYGUI.

Not all properties or methods will be detailed as many are inherited from their 
ancestor, the [qtpyBase_Control](#_qtpybase_control)

The properties used by almost all controls, and which should be committed to memory, are:

  - **"tag"**, the system name for the control
    - Must be specified if the control is going to be used in the code, 
    if not, it can be omitted and the system will generate
a unique tag name
  - **"callback"**, the method that will process events generated by the GUI control. 
    - Takes one argument - an [Action](#action) instance which has many useful 
    properties and methods and is critical to QTPYGUI programming. 
    - callback can be omitted for controls, like [Label](#label), where the 
    programmer has no interest in the events generated by the control
  - **"text"**, not all controls use this as they do not display text
  - **"width"**, the width of the control in characters if pixel_unit is False, Otherwise in pixels
  - **"height"**, the height of the control in characters if the pixel_unit is False, Otherwise in pixels

Only where a programmer is after a special layout or effect, will the other properties come into play
- Some controls, like the [Grid](#grid), will have special properties that need setting
  
It is suggested to set the "height" and "width" properties as the font selected might not
automatically size correctly and the defaults might not suit.
- This is particularly the case in fonts that are not monospaced.

Where the "txt_font" is set, it overrides the other text related font properties

[GUI Controls](#gui-controls-1) are housed in [Containers](#containers) and the container_tag and 
tag make a unique pair in the form layout

#### GUI Controls

| Control                         | Description                                                                                                                  |
|---------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [Button](#button)               | Creates a button, text and icon are optional                                                                                 |
| [Checkbox](#checkbox)           | Creates a check box that a user can click on or off                                                                          | 
| [ComboBox](#combobox)           | Creates a drop down selection box, icon in list is <br/>optional                                                             |
| [Dateedit](#dateedit)           | Creates a date edit control with a dropdown calendar and <br/>an erase button                                                |
| [FolderView](#folderview)       | Creates a control that displays the contents of a folder in a grid format                                                    |
| [Grid](#grid)                   | Creates a control that displays data in a table (grid) format                                                                |
| [Image](#image)                 | Creates a control that displays an image                                                                                     |
| [Label](#label)                 | Creates a text string                                                                                                        |
| [LCD](#lcd)                     | Creates a control that displays an LCD calculator display<br>Only numbers can be displayed                                   |
| [LineEdit](#lineedit)           | Creates a control that allows text to be edited and displayed<br/> in a single line                                          |
| [Menu](#menu)                   | Creates a menu just below the title bar                                                                                      |
| [PlainTextEdit](#plaintextedit) | Creates a plain text entry control that can span multiple lines                                                              |
| [ProgressBar](#progressbar)     | Creates a control that displays the progress of an operation                                                                 |
| [RadioButton](#radiobutton)     | Creates a radio button control. In a group only one can be <br/>selected at a time                                           |
| [Slider](#slider)               | Creates a slider control than can be used to set a value <br/>by dragging the handle                                         |
| [Spacer](#spacer)               | Creates a spacer control used to format layout                                                                               |
| [Spinbox](#spinbox)             | Creates a spinbox control that allows numbers to be set <br/>via clicking up and down arrows or entering the number directly |
| [Switch](#switch)               | Creates a switch control that can be used to turn on and <br/>off a feature                                                  |
| [Tab](#tab)                     | Creates a tab control that has multiple pages, each <br/>housing their own set of [GUI Controls](#gui-controls-1)            |
| [TextEdit](#textedit)           | Creates a text entry control that can span multiple lines                                                                    |
| [Timeedit](#timeedit)           | Creates a time edit control with an erase button                                                                             |
| [Treeview](#treeview)           | Creates a control that displays data as a tree view                                                                          |

### _qtpyBase_Control
 
This is the ancestor of all QTPYGUI [GUI controls](#qtpygui-control-api-reference),
and the properties here are used to set the behavior of the GUI control when instantiated.
  
**Properties** 
- Not all properties will be supported or used by descendant [GUI Controls](#gui-controls-1) and will be ignored
- Some properties will be overridden by descendant [GUI Controls](#gui-controls-1)

| **Property**      | **Type**                                       | **Description**                                                                                                                                   |
|-------------------|------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| align             | [Align](#align) (Align.LEFT)                   | Used to align [GUI Controls](#gui-controls-1) in containers                                                                                                          |
| allow_clear       | bool (True)                                    | True, allow [GUI Controls](#gui-controls-1) that can be cleared to be cleared, Otherwise not                                                                         |
| bold              | bool (False)                                   | True, sets [GUI Controls](#gui-controls-1) that have text bold, Otherwise not                                                                                        |
| buddy_control     | _qtpyBase_Control \| None (None)               | Set the buddy GUI control or Container                                                                                                            | 
| buddy_callback    | Callable \| None (None)                        | Sets the callback method for the buddy GUI control (Functon, Method or Lambda)                                                                    |
| callback          | Callable \| None (None)                        | Sets the callback method for the GUI control (Functon, Method or Lambda)                                                                          |
| container_tag     | str ("")                                       | Sets the container_tag for the GUI control. If "" then system generated                                                                           |
| editable          | bool (True)                                    | True, sets [GUI Controls](#gui-controls-1) that support editing into edit mode, Otherwise not                                                                        |
| enabled           | bool (True)                                    | True, enables the GUI control, Otherwise disable the GUI control                                                                                  |
| frame             | [Widget_Frame](#widget_frame) \| None (None)   | Sets the frame of a GUI control tht supports frames                                                                                               |
| icon              | None \| qtG.QIcon \| qtG.QPixmap \| str (None) | Sets the icon on a GUI control were supported. If a str then this is the filename  of the icon                                                    |
| italic            | bool (False)                                   | True, sets [GUI Controls](#gui-controls-1) that have text italic, Otherwise not                                                                                      |
| height            | int (-1)                                       | The height of the GUI control in characters if pixel_unit is False, Otherwise the height is in pixels.<br> -1 automatically calculates the height |
| label             | str ("")                                       | The label string, if not provided no label is shown                                                                                               |
| label_align       | [Align_Text](#align_text) (Align_Text.RIGHT)   | The alignment of the label text                                                                                                                   |
| label_width       | int (-1)                                       | The width of the label in  characters if pixel_unit is False, Otherwise the width is in pixels.<br> -1 automatically calculates the width         |
| label_font        | [Font](#font) \| None (None)                   | The Font of the label                                                                                                                             |
| pixel_unit        | bool (False)                                   | True, width and height settings are in pixels, Otherwise in characters                                                                            |
| size_fixed        | bool (True)                                    | True, Sets the size of the [GUI Controls](#gui-controls-1) as fixed, Otherwise not fixed. TODO: fix this setting as it has no effect                                 |
| tag               | str ("")                                       | The tag of the GUI control, system generated. If "" then system generated                                                                         |
| text              | str ("")                                       | The text displayed on the GUI control if this is supported by the GUI control                                                                     |
| tooltip           | str ("")                                       | The tooltip displayed when the mouse hovers over the GUI control                                                                                  |
| txt_align         | [Align_Text](#align_text) (Align_Text.LEFT)    | Aligns the [GUI Controls](#gui-controls-1) text, if supported.                                                                                                       |
| txt_font          | [Font](#None)\| None (None)                    | The font of the [GUI Controls](#gui-controls-1) text, if supported                                                                                                   |
| txt_fontsize      | int (DEFAULT_FONT_SIZE)                        | The fontsize in points of the GUI control text, if supported                                                                                      |
| tune_vsize        | int (0)                                        | Used to adjust the vertical size of the GUI control. In pixels                                                                                    |
| tune_hsize        | int (0)                                        | Used to adjust the horizontal size of the GUI control. In pixels                                                                                  |
| translate         | bool (True)                                    | True, translate the text on the GUI control, if supported, Otherwiise not                                                                         |
| width             | int (-1)                                       | The width of the GUI control in characters if pixel_unit is False, Otherwise the width is in pixels.<br> -1 automatically calculates the width    |
| underline         | bool (False)                                   | True, sets [GUI Controls](#gui-controls-1) that have text underline, Otherwise not                                                                                   |
| user_data         | any (None)                                     | User sepecified data attached to the GUI control                                                                                                  |
| validate_callback | Callable \| None (None)                        | A callback to validate the contents of the GUI control. Applicable only to GUI controls that allow the entry of text                              |
| visible           | bool (True)                                    | True, make the GUI control visible,Otherwise hide the GUI control                                                                                 |

**Methods** 
- Not all methods will be used by descendant [GUI Controls](#gui-controls-1)
- Some methods will be overridden

| **Method**          | **Arguments**   | **Type**                                                                                       | **Description**                                                                                                                      | **Optional** |
|---------------------|-----------------|------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|--------------|
| block_signals       |                 | None                                                                                           | Blocks or unblocks signals for the widget (Used rarely where signals might be generated very frequently e.g. [Slider](#slider))      |              |
|                     | block_signals   | bool (True)                                                                                    | True, stop this widget from generating signals (events), Otherwise do not stop signals (events)  being generated .           | ✓            |
| clear               |                 | None                                                                                           | Clears the contents of the GUI control, if supported                                                                                 |              | 
| buddy_text_set      |                 | None                                                                                           | Sets the text on the buddy control, where supported                                                                                  |              |
|                     | value           | str                                                                                            | The label text set to the left of the buddy widget.                                                                                  | ❌            |
| ediitable_set       |                 | None                                                                                           | Controls the edit setting of a GUI control, where supported.                                                                         |              |
|                     | editable        | bool (False)                                                                                   | True, set the GUI control editable, where supported, Otherwise not.                                                                  | ✓            |
| enable_get          |                 | bool                                                                                           | <br><b>Returns:</b><br> The enable value of the widget.<br>                                                                          |              |
| enable_set          |                 | int                                                                                            | Enables/Disables the GUI control where supported <br><b>Returns:</b><br> 1 - set ok, -1 - set failed<br>                             |              |
|                     | enable          | bool                                                                                           | True enable control, Otherwise disable the control.                                                                                  | ❌            |
| fonts_available_get |                 | tuple[str]                                                                                     | <br><b>Returns:</b><br> A tuple of font name strings.<br>                                                                            |              |
| font_set            |                 | None                                                                                           | Sets the font on the GUI control (Usually used internally as the [Font](#font) property is set when the GUI control is instantiated) |              |
|                     | app_font        | Font                                                                                           | Application font                                                                                                                     | ❌            |
|                     | widget_font     | Font                                                                                           | Control font                                                                                                                         | ❌            |
|                     | widget          | qtW.QWidget (None)                                                                             | The QT widget having the font set (defaults to current GUI control)                                                                  | ✓            |
| font_system_get     |                 | None                                                                                           | Gets the sstem font <br><b>Returns:</b><br> A QFont object.<br>                                                                      |              |
|                     | fixed           | bool (True)                                                                                    | True, return the fixed size system font, Otherwise not                                                                               |              |
| frame_style_set     |                 | None                                                                                           | Sets the frame style of the GUI control, where supported                                                                             |              |
|                     | frame           | [Widget_Frame](#widget_frame)                                                                  | Frame definition object.                                                                                                             | ✓            |
| icon_set            |                 | None                                                                                           |                                                                                                                                      |              |
|                     | icon            | None \| qtG.QIcon \| qtG.QPixmap \| str                                                        | Sets the icon on a GUI control were supported. If a str then this is the filename  of the icon                                       | ❌            |
| guiwidget_get       |                 | qtW.QWidget                                                                                    | Returns the underlying QT widget so that specialised operations can be performed<br><b>Returns:</b><br> The QT GUI widget.<br>       |              |
| guiwidget_set       |                 | None                                                                                           | Sets the GUI Control (Almost never used by QTPYGUI programmers)                                                                      |              |
|                     | widget          | qtW.QWidget \| qtG.QAction                                                                     | The widget being set                                                                                                                 | ❌            |
| pixel_str_size      |                 | [Char_Pixel_Size](#char_pixel_size)                                                            | <br><b>Returns:</b><br> The pixel size of the string in a [Char_Pixel_Size](#char_pixel_size) instance   .<br>                       |              |
|                     | text            | str                                                                                            | The text to be measured                                                                                                              | ❌            |
| pixel_char_size     |                 | [Char_Pixel_Size](#char_pixel_size)                                                            | The size of a char in pixels<br><b>Returns:</b><br> [Char_Pixel_Size](#char_pixel_size) <br>                                         |              |
|                     | char_height     | int                                                                                            | Character height in chars                                                                                                            | ❌            |
|                     | char_width      | int                                                                                            | Character width in chars                                                                                                             | ❌            |
|                     | height_fudge    | float (1.1)                                                                                    | Fudge factor multiplier to provide height adjustment                                                                                 | ✓            |
|                     | width_fudge     | float (1.1)                                                                                    | Fudge factor multiplier to provide width adjustment                                                                                  | ✓            |
| text_pixel_size     |                 | tuple[int,int]                                                                                 | Returns the height and width of a string of text in pixels <br><b>Returns:</b><br> The [height,width] of the text in pixels.<br>     |              |
|                     | text            | str                                                                                            | The text to be measured.