ScorpiUI: A Python UI library for building web apps with minimal HTML, CSS, and JS.
Project description
ScorpiUI
ScorpiUI is a Python-based UI library designed to simplify frontend development for Python backend developers. With ScorpiUI, you can create dynamic and interactive web applications using Python alone, reducing the need for traditional frontend technologies such as HTML, CSS, and JavaScript.
Features
-
Pythonic Development: ScorpiUI allows you to define UI components, handle events, and execute JavaScript code entirely in Python, making frontend development more accessible to Python developers.
-
Customizable Components: ScorpiUI provides a range of customizable UI components, including buttons, forms, modals, and more, allowing you to create rich user interfaces tailored to your application's needs.
-
Event Handling: Easily handle user interactions and events with Python functions, making it straightforward to implement dynamic behavior in your web applications.
-
CSS Styling: Customize the appearance of your UI components using custom CSS styles directly within your Python code, ensuring consistent and visually appealing designs.
-
JavaScript Execution: Execute client-side JavaScript code in response to user actions, enabling real-time interactivity and enhancing the user experience.
Installation
You can install ScorpiUI using pip:
pip install scorpiui
Getting Started
Here's a simple example of how to create a page with single button with ScorpiUI:
1 Create your new project folder and open it. 2 Create file called
app.pyin your project root directory. Here's sampleapp.pycode to get started:
from scorpiui.app import app, run_app
from scorpiui.components.button import Button
from scorpiui.components.text_input import TextInput
from flask import render_template
# Store input values
input_values = {}
def on_text_change(value):
input_values['text_input'] = value
print("Text input changed:", value)
def on_button_click():
text = input_values.get('text_input', '')
print("Button clicked", text)
# Create a TextInput instance
my_text_input = TextInput(
placeholder="Enter text here...",
height=30,
width=200,
background_color="#ffffff",
text_color="#000000",
border_radius="5px",
text_align="left",
read_only=False,
on_change=on_text_change,
js_code='console.log("Input changed");',
css_code='border: 1px solid #ccc; padding: 5px;'
)
# Create a button instance with the desired properties, JS code, and CSS code
my_button = Button(
label="Click Me",
height=50,
width=150,
background_color="#3498db",
text_color="#ffffff",
border_radius="12px",
onclick=on_button_click,
js_code='alert("Button successfully clicked!");',
css_code='border: 5px solid red; color: yellow; text-align: center; font-size: 16px; cursor: pointer;'
)
@app.route('/')
def home():
button_html = my_button.render()
input_html = my_text_input.render()
HTMLcontent = button_html + input_html
return render_template('base.html', content=HTMLcontent, title="ScorpiUI Test")
if __name__ == '__main__':
run_app()
3 Now, open terminal in your project's root directory run your web app:
python3 app.py
Contributing
Contributions are welcome! If you have any ideas, bug fixes, or enhancements, feel free to open an issue or submit a pull request on the GitHub repository.
License
ScorpiUI is licensed under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scorpiui-0.0.1.tar.gz.
File metadata
- Download URL: scorpiui-0.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
787b691f3cff330d9f18cf30509e0ea340acdf5b3230163421f667d92ae734f4
|
|
| MD5 |
7c3538f2076fb038ff47e972392d621a
|
|
| BLAKE2b-256 |
755c4a9122ddfdb932fadca5ff3158e3ffbf4b623ca85a83bb7d6feb7ae1d9c9
|
File details
Details for the file scorpiui-0.0.1-py3-none-any.whl.
File metadata
- Download URL: scorpiui-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b47cf0bd01fe2215253c30a2ed929774663ed7a030c98de5ecd531f30e6ad97e
|
|
| MD5 |
dd8753a7e9c78598bf5655a4371de809
|
|
| BLAKE2b-256 |
b79f7e0a14c8634d162a1aefd1c5add6ccddbed8171c0bdcf7f25892e40874ea
|