A custom Tkinter widget that displays Loguru log messages in real-time with support for styling and colors. Monitor application logs directly within your Tkinter GUI.
Project description
Loguru Tkinter Widget
A thread-safe, customizable Tkinter widget for displaying Loguru logs in real-time.
Features
- Real-time log display in a Tkinter application
- Thread-safe implementation using a queue
- Customizable color modes for log levels
- Adjustable maximum number of displayed log lines
- Optional scrollbar
- Easy integration with existing Loguru logger
Installation
- Ensure you have Python 3.6+ installed on your system.
- Install the required dependencies:
pip install tkloguru
- Copy the
LoguruWidget
class and related functions into your project.
Usage
Here's a basic example of how to use the Loguru Tkinter Widget:
import tkinter as tk
from loguru import logger
from loguru_widget import LoguruWidget, setup_logger
root = tk.Tk()
root.title("Loguru Tkinter Widget Demo")
root.geometry("600x400")
log_widget = LoguruWidget(root, show_scrollbar=True, color_mode='level', max_lines=1000)
log_widget.pack(expand=True, fill=tk.BOTH, padx=10, pady=10)
setup_logger(log_widget)
# Example log messages
logger.debug("This is a debug message")
logger.info("This is an info message")
logger.success("This is a success message")
logger.warning("This is a warning message")
logger.error("This is an error message")
logger.critical("This is a critical message")
root.mainloop()
Customization
The LoguruWidget
class accepts several parameters for customization:
master
: The parent Tkinter widget (required)show_scrollbar
: Boolean to show/hide the scrollbar (default: True)color_mode
: String to set the coloring mode ('level', 'message', or 'full') (default: 'level')max_lines
: Integer to set the maximum number of displayed log lines (default: 1000)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tkloguru-0.1.0.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file tkloguru-0.1.0.tar.gz
.
File metadata
- Download URL: tkloguru-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffe96473789a0d668cc3f5d97baa2daf8d36da5eff3e74e66477467f7552563b |
|
MD5 | 3a3090b9eb467574c653b475874267a3 |
|
BLAKE2b-256 | 30fd0622726142c67749113c59eb5ce7bc7633daee9f375d973669f053a4efa4 |
File details
Details for the file tkloguru-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tkloguru-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77546d4a426b05c40a7ca86970a6657166b129d1c37ede602b61928c87f0cb7e |
|
MD5 | 8c974dd0f398a0f5efca4bf0fb143041 |
|
BLAKE2b-256 | 6f8d9103ee122e9ee61f549447d7247466aa94d137e49f0c63d1e121d449b958 |