Skip to main content

A Python library for creating GUIs in HTML/CSS like syntax

Project description

The sagetk Python module

sagetk is a Python module for creating GUI applications using a HTML and CSS like syntax . It is built on top of classical tkinter library and provides a high-level interface for defining widgets, handling events, and managing application state.

INSTALLATIONS:

sagetk can be installed using pip:

pip install sagetk

It depends on few other packages, including, pillow and html.parser, which will also be installed automatically.

USAGE

The basic usage of sagetk involves defining a document object that describes the structure and content of the GUI using a markup language similar to HTML. This document can include various widgets, such as buttons, labels, text areas, menus, and tables, as well as event handlers that respond to user interactions with the widgets.

Once the document is defined, it can be displayed in a window by calling the document() function from the sagetk module that serves the document and handles user interactions, such as clicks, key presses, and mouse movements.

The run() function can then be called to start the event loop and handle these interactions. This function blocks until the user closes the window or the program exits.

DOCUMENTATIONS

The sagetk module includes comprehensive documentation that covers the various widgets, events, functions, and classes available in the library. The documentation is available online at http://sagetk.atspace.cc, and can also be accessed programmatically using the help() function in Python.

EXAMPLES

The sagetk module includes several examples that demonstrate the usage and capabilities of the library. These examples cover a wide range of GUI applications, from simple calculators and text editors to more complex data analysis tools and scientific simulations.

The examples are located in the examples directory of the sagetk source distribution, and can be run by executing the corresponding Python scripts. They can also be used as templates or starting points for building custom GUI applications using sagetk.

//CREATING BUTTON import sagetk as tk tk.g=globals() doc=””” <root> <title>my app</title> <button onclick=”alert(‘hello world’)”>Click here</button> </root> “”” tk.document(doc) tk.run()

//CREATING INPUTS import sagetk as tk tk.g=globals() doc=””” <root> <title>my app</title> <input type=”text”></input> </root> “”” tk.document(doc) tk.run()

//CREATING TABLE import sagetk as tk tk.g=globals() doc=””” <root> <title>my app</title> <table> <tr> <th>name</th> <th>age</th> </tr> <tr> <td>Mark</td> <td>77</td> </tr> </table> </root> “”” tk.document(doc) tk.run()

//CREATING Menu import sagetk as tk tk.g=globals() doc=””” <root> <title>my app</title> <menu> <mi label=file> <md onclick=”func”>open</md> <sp></sp> <md>save as</md> </mi> <mi label=edit> <md alt=”ctrl + x”>cut</md> <sp></sp> <md alt=”ctrl + c”>copy</md> </mi> </menu> </root> “”” tk.document(doc) tk.run()

Change log

0.0.1 (02/04/2023)

Third release

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

sagetk-0.0.3.tar.gz (13.2 kB view hashes)

Uploaded Source

Supported by

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