Skip to main content

Loguru Tkinter Widget

A thread-safe, customizable Tkinter widget for displaying Loguru logs in real-time.

Loguru Tkinter Widget Demo

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

  1. Ensure you have Python 3.6+ installed on your system.
  2. Install the required dependencies:
pip install tkloguru
  1. 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

  • Loguru for the excellent logging library
  • Tkinter for the GUI framework

Metadata

Release files for tkloguru 0.1.2

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

Source distribution (sdist)

Source distribution for tkloguru 0.1.2
File Size Uploaded Provenance Actions
tkloguru-0.1.2.tar.gz 6.2 kB Without provenance Details for tkloguru-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 12.7 kB

Release files / tkloguru-0.1.2.tar.gz

Download URL tkloguru-0.1.2.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d13c231da165fe9c519c271050e754005e65b8406d4015db2a7c6f260bfe8399
BLAKE2b-256 checksum
How to use checksums
e6c03308477002a53b7ec4a5f1a5ee1fd338c00771fdba4bab4ef7f94af3f029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Windows/10

Release files / tkloguru-0.1.2-py3-none-any.whl

Download URL tkloguru-0.1.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6793c18100226a5c797d60755a0de37f6b8ab056e036d417392064041f70aeda
BLAKE2b-256 checksum
How to use checksums
959723de03eed35529743ad779b41bf8becd0148326eb0dd855b8dfbcae5a269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Windows/10

Security for tkloguru 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

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