Skip to main content

A simple wrapper for Windows' MessageBoxW in Python

Project description

winmsgbox

A simple wrapper of Windows' MessageBoxW function written in Python to display message boxes.

Features

  • Display native Windows message boxes from Python
  • Choose button sets, icons, default buttons, modality, and more
  • Typed constants for easy configuration

Requirements

  • Windows OS
  • Python 3.x

Installation

Simply install using pip install winmsgbox

Usage

from winmsgbox import MessageBox, Buttons, Icon, DefaultButton, Modal, Flags, Response

result = MessageBox(
    title="Hello",
    text="This is a message box.",
    buttons=Buttons.OkCancel,
    icon=Icon.Information,
    defaultButton=DefaultButton.First,
    modal=Modal.ApplModal,
    flags=Flags.SetForeground
)

if result == Response.Ok:
    print("User clicked OK")
elif result == Response.Cancel:
    print("User clicked Cancel")

API Reference

MessageBox

MessageBox(
    title="",
    text="",
    buttons=Buttons.Ok,
    icon=Icon.Empty,
    defaultButton=DefaultButton.First,
    modal=Modal.ApplModal,
    flags=0x00000000,
    window=0
) -> int

Displays a Windows message box with the specified parameters. Returns an integer corresponding to the button clicked.

Constants

  • Buttons: Ok, OkCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel, CancelTryContinue
  • Icon: Empty, Error, Question, Warning, Information
  • DefaultButton: First, Second, Third, Fourth
  • Modal: ApplModal, SystemModal, TaskModal
  • Flags: DefaultDesktopOnly, Right, RtlReading, SetForeground, TopMost, ServiceNotification
  • Response: Ok, Cancel, Abort, Retry, Ignore, Yes, No, TryAgain, Continue

License

GNU AGPL v3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

winmsgbox-1.0.1.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

winmsgbox-1.0.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file winmsgbox-1.0.1.tar.gz.

File metadata

  • Download URL: winmsgbox-1.0.1.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for winmsgbox-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e17b9a4a0e6fccc71f7e1f2a3112cf2a30fc9d5b0256c679c4a7bddd665a33b9
MD5 4cd9f5fa4fabcc73224549f6c26d93d3
BLAKE2b-256 be776d7f8c69a8640d1bc9ae643fe975eb12112da34ec8fc27f374631920e2eb

See more details on using hashes here.

File details

Details for the file winmsgbox-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: winmsgbox-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for winmsgbox-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9af7704016104b443102e8285136c3f81d2444b7d35301c84aa843e68beae543
MD5 d82f330e7f998d7aa5ef61b6b85be7ce
BLAKE2b-256 15847ffa0b301e8a71480205996174ef23945c0fec7bbc1f299c521f52c17d14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page