Skip to main content

popui

A Python module for creating GUI popups with Dear PyGui and AutoHotkey on Windows

Installation

pip install popui

Usage

To create a popup, first define a function that builds the GUI.

from popui import Popup

def build(popup: Popup):
    popup.add_button('Do something', callback=lambda: print('Doing something'))
    popup.add_button("Do Nothing (Keep window open)", popup.no_op, close=False)
    popup.add_keybind('tab', lambda: print('Tabbing'))

The popup.add_button() method is a convenience method that creates a button that will close the popup window after the callback function is called by default. The add_keybind() method is a convenience method that causes the provided callback to be called when the specified keybind is pressed while the window is active.

Then, create a Popup object with the function and any additional options that you would typically pass to as arguments to a dearpygui viewport.

if __name__ == '__main__':
    popup = Popup('^space', build, width=200, height=200) # Control + Space will toggle the popup
    popup.block()

The block method will block the current thread indefinitely. Pressing the hotkey will toggle the popup window.

Dear PyGui elements

For more complex GUIs, you can use the gui attribute of the popup to create a GUI with the same syntax as Dear PyGui. (See more at https://dearpygui.readthedocs.io/en/latest/index.html). If used as a context manager, any elements created within the context will be parented to the popup window automatically.

popup.gui.add_text(label='Hello, world!', parent=popup.root)

with popup as gui:
    gui.add_checkbox(label='Box', callback=lambda: print('Box checked'))
    with gui.tab_bar():
        gui.add_tab(label='Tab 1')
        gui.add_tab(label='Tab 2')

Application specific popups

You can create a popup that is specific to an application by using the application parameter of the Popup class. This will ensure that the popup is only shown when the specified application is in focus.

The application argument should be in autohotkey title format. For example, to create a popup that is only shown when Notepad is in focus, you would use the following:

popup = Popup('~!e',
              build,
              anchor=Popup.ON_APP,
              application='ahk_exe notepad.exe',
              decorated=False, # Removes the title bar and border from the viewport (much better looking imo)
              width=200,
              height=200).build()

Metadata

Release files for popui 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for popui 0.0.16
File Size Uploaded
popui-0.0.16.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for popui 0.0.16
File Interpreter ABI Platform
popui-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / popui-0.0.16.tar.gz

Download URL popui-0.0.16.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4421c808b8aae60e9259442e0afad889b4b1b9f2f2ddb894096a58f4bc01b4ea
BLAKE2b-256 checksum
How to use checksums
d5db459777c894fd985375f8a4bf70bd2048d917d265e7a7f4614b2239180eaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / popui-0.0.16-py3-none-any.whl

Download URL popui-0.0.16-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
290ee405fc389ecbdab5129e46e1290631a113709c2be06b9cceebd14bce1092
BLAKE2b-256 checksum
How to use checksums
c2016dc1d5fbb147bceea35a25deacef912a5ce7a44cb155714542051fc545cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.0.16 This release

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page