Skip to main content

A package that allows developers to create popup messages to aid in debugging and add some spice into their coding process.

Project description

PopMessage

PopMessage is a Python package that enhances your development process with customizable pop-up messages. It allows you to display reminders, debug feedback, and fun surprises through pop-ups with random colors and sounds. With timer functionality, you can set delays for reminders, while error and debug pop-ups provide real-time feedback on your code. Whether you need a moment of wholesome encouragement or a playful surprise, PopMessage adds a unique touch to your coding experience.

// insert pypi badge [badge](link to workflows)

PyPI Link

PopMessage on PyPI

Features

  • Popup Windows Setup: Helper functions to create and display popup messages with specified or default properties.
  • Timer Functionality: Set a timer for reminders to display pop-up messages after a specified delay.
  • Error and Debug Pop-ups: Receive success or error messages with feedback on the status of your code.
  • Surprise Me!: Display random messages such as wholesome reminders, fun surprises, and even a few playful or humorous ones.
  • Random Colors and Sounds: Each pop-up can have randomly generated colors and sounds for extra fun.

Installation

Developer Setup

If you're looking to set up the project locally, follow these steps:

Usage

You can easily import PopMessage into your Python project and start using the functions right away. Here's how you can use the package:

Import PopupMessage module:

from popmessage.popmsg import PopupMessage

Constructor

__init__(self)

Constructs an instance of the PopupMessage class which represents a pop-up message window. It initializes instance variables with default properties for the pop-up message window. Developers who want to create an instance of PopupMessage class should call PopupMessage().

Upon instantiation, each PopupMessage object has the following properties with default values:

  • message: The message to be displayed in the pop-up window. Defaults to "Default Message"
  • bgColor: The background color in the pop-up window.Defaults to "white".
  • fontColor: The text color of the displayed message. Defaults to "black".
  • fontSize: The font size of the displayed message. Defaults to 75.
  • timerDuration: The number of minutes before the pop-up window gets displayed. Defaults to 0.

Parameters: None

Return: None

Public Methods

displayPopup(self, msg=None, bgColor=None, fontColor=None, fontSize=None)

This method displays the pop-up message window with customized properties defined through the parameters. If any of the parameters are not specified, it will default the property to the last configured value.

Parameters:

  • message (str, optional): The message to be displayed in the pop-up window. Defaults to the last configured value.
  • bgColor (str or tuple, optional): The background color in the pop-up window.Defaults to the last configured value.
  • fontColor (str or tuple, optional): The text color of the displayed message. Defaults to the last configured value.
  • fontSize (int, optional): The font size of the displayed message. Defaults to the last configured value.

Return: None


displayTimerPopup(self, msg=None, bgColor=None, fontColor=None, fontSize=None, timerDuration=None)

TO ADD


displaySFPopup(self, code_to_execute)

TO ADD


displayRandomPopup(self)

TO ADD

Examples

1. Create and display a pop-up message window with default properties

You can create a basic pop-up message window by creating an instance of PopupMessage class first and then call displayPopup() with no parameters specified.

# Example1: Create and display a pop-up message window with default properties
myPopup1 = PopupMessage()
myPopup1.displayPopup()

2. Create and display a pop-up message window with customized properties

To customize a basic pop-up message window, you can invoke displayPopup() method on an existing instance of PopupMessage and specify the properties you want to customize through its parameters.

# Example2: Create and display a pop-up message window with customized properties
myPopup2 = PopupMessage()
myPopup2.displayPopup(msg="Hello World", bgColor="blue", fontSize=75)

3. Create and display a delayed / timed pop-up message window with customized properties

TO ADD

4. Create and display a coding-feedback pop-up message window

TO ADD

5. Create and display a random pop-up message window

TO ADD

Link to an example Python program using our package: demo.py

Contributing

We welcome contributions! If you'd like to contribute to our package, here's how to set up your development environment:

  1. This module requires Python version 3.10 or higher. Install Python and pipenv if not already installed.

  2. Clone our git repository to your local machine. Run git clone https://github.com/software-students-spring2025/3-python-package-push-then-pull.git

  3. Go to your cloned project directory, then create and activate a virtual environment: pipenv shell

  4. Inside your active virtual environment, install the following dependencies by running these commands:

    pipenv install kivy
    pipenv install pytest
    pipenv install pytest-mock
    pipenv install build
    pipenv install twine
    
  5. For development purposes, install the package in "editable" mode so that changes to the package are immediately updated in the virtual environment.

  • Run pipenv install -e . from the main project directory.
  1. Check Pipfile to verify all the dependencies are installed. Make sure python_version is the 3.10 or above.
  2. Now you are ready to contribute to our module. To add new features to our module, write your code under src/popmessage directory. The main code of our module is located in src/popmessage/popmsg.py file. (see additional documentation for contributors below)
  3. Any unit tests you've created should be included within the tests directory.
  4. To run the unit tests manually, navigate to the main project directory and run: python3 -m pytest
  • If the above command throws any error, try pipenv run python3 -m pytest, or exit and reactivate your virtual environment and try again.

For testing purposes you can follow these steps to build and upload your enhanced package to TestPyPI:

  1. Build the project by running python -m build from the same directory where the pyproject.toml file is located.
  2. Verify that the built .tar archive has the files you expect your package to have (including any important non-code files) by running the command: tar --list -f dist/popmessage-0.0.3.tar.gz, where popmessage-0.0.3 is replaced with your own package name and version.
  3. Create an account on TestPyPI where one can upload to a test repository instead of the production PyPI repo.
  4. Create a new API token on TestPyPI with the "Scope" set to “Entire account”. Save a copy of the token somewhere safe.
  5. Upload your package to the TestPyPI repository using twine, e.g. twine upload -r testpypi dist/*
  6. Twine will output the URL of your package on the PyPI website - load that URL in your web browser to see your packaged published

Every time you change the code in your package, you will need to rebuild and reupload it to PyPI. You will need to build from a clean slate and update the version number to achieve this:

  1. delete the autogenerated dist directory
  2. delete the autogenerated src/*.egg-info directory
  3. update the version number in pyproject.toml and anywhere else it is mentioned (do a find/replace) (e.g., from 0.0.3 to 0.0.4)
  4. build the package again with python -m build
  5. upload the package again with twine upload -r testpypi dist/*

Repeat as many times as necessary until the package works as expected.

Once you are satisfied with your changes, you are now ready to push your changes.

  1. Before pushing your changes, make sure the version number in pyproject.toml or anywhere else it is mentioned is updated.
  2. Now you can push your changes to your branch in the Github repository.
  3. Once you submit a pull request, this will trigger GitHub Actions to run the automated unit tests. One of the maintainers of the repository will review your pull request. If approved, your latest code changes will be uploaded to the real PyPI by the maintainer.

Additional Documentation for Contributors

PopupMessage class is a subclass of kivy.app.App class. The following methods are located in PopupMessage and can be enhanced by contributors.

_setProperties(msg, bgColor, fontColor, fontSize, timerDuration)

A protected method that sets the properties of the pop-up message window.


_createPopup(self)

A protected method that creates the pop-up message window with the configured properties.

Returns the layout for rendering.


build(self)

Kivy's abstract method that every subclass must implement and gets automatically invoked after App.run() is called.

Returns the created pop-up window layout.


Compatibility Notice

The popmessage package relies on the Kivy library, which may cause compatibility issues on Linux systems.

Teammates

Configuration and Environment Variables

(prob not needed but just here as a placeholder)

Running the Project

License

Click Here to view the license.

Acknowledgments

  • Thanks to Kivy for providing a great GUI framework.
  • Inspired by the need for interactive pop-up reminders in Python applications.

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

popmessage-0.0.7.tar.gz (49.3 kB view details)

Uploaded Source

Built Distribution

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

popmessage-0.0.7-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file popmessage-0.0.7.tar.gz.

File metadata

  • Download URL: popmessage-0.0.7.tar.gz
  • Upload date:
  • Size: 49.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for popmessage-0.0.7.tar.gz
Algorithm Hash digest
SHA256 bc86711d0689091c8bed477ec3e769be66431ce959f441bd2e6be49d115f1487
MD5 e88530a94588f85d60afa4858e13de3a
BLAKE2b-256 0353619d17a766287e26201bddbadfd54615cc1a5e9220fb93d720ce8f9d3055

See more details on using hashes here.

File details

Details for the file popmessage-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: popmessage-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for popmessage-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8661b7937f39ab4dd360371805971dee597cd2dd9275515943fe9f491e5b6867
MD5 89c6574cf61554828faa7784fb8c825b
BLAKE2b-256 32d9198b090973885ea43c7b4acdc1d73ffceea33f174ef1761eb10bb159ca71

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