Skip to main content

UI Style Lang (Language)

"UI Style Lang"

UI Style Lang is a simple CSS-like language which allows for drawing and styling wxPython elements. Many UI Style Lang properties are the same as the normal (not short-hand) CSS3 properties. This provides a familiar syntax, especially for those with experience with CSS3.

If you are looking for an easy way to:

  • Draw shapes, text and/or images in wxPython without worrying so much about ids, brushes, pens, etc.
  • Style the native wxPython widgets from a stylesheet
  • Create your own custom widgets in wxPython that can be styled with a CSS-like stylesheet

...then UI Style Lang is likely the module you're looking for.

WIP/ TODO

  • SVG support(?)

Features

  • Written in pure Python with minimal dependancies (just wxPython and the standard library)

  • Drawing API

    • Includes the UIStylePDC UI Style Lang class which is a powerful extension of the wxPython wx.PseudoDC
    • Over 15 stylesheet properties already supported
    • Draw circles, rectangles, squares, images, & text
    • Translate & rotate elements
    • Load styles from inline styles, string and/or an external stylesheet
    • Auto-handles wxPython IDs, with support for manual-handling of IDs
  • Native Widget Styling API

    • Supports loading from a stylesheet for easy theming
    • Support for styling app, panels, frames and static text widgets

...and more.

Usage and Examples

See the documentation at Read the Docs and full demo examples for information on usage...

What does the syntax look like?

UI Style Lang (Stylesheet API) example:

/* My custom button styles */
@style button {
  background-color: #F4F4F4;
  top: 20px;
  left: 40px;
  width: 115px;
  height: 35px;
  border-color: #D1D1D1;
  border-size: 2px;
}

@style button:hover {
  background-color: #FDFDFD;
  top: 20px;
  left: 40px;
  width: 115px;
  height: 35px;
  border-color: #D1D1D1;
  border-size: 2px;
}

Python API example:

# Intilizing the element: <div id="button"></div>
>> dc.InitElem("button")

# Editing the style with inline styles: <div id="button" style="border-color: red; border-width: 4px;"></div>
>> dc.UpdateElem('button', styles="border-color: red; border-width: 4px;")

# Update the element with the 'hover' styles: <div id="button" class="hover"></div>
>> dc.UpdateElem('button:hover')

Development

Pull requests and/or feature suggestions are welcome!

License

UI Style Lang is licensed under the BSD 3-Clause license

Metadata

Release files for uistylelang 0.8.5

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

Source distribution (sdist)

Source distribution for uistylelang 0.8.5
File Size Uploaded
uistylelang-0.8.5.tar.gz 12.3 kB Details

Built distribution (wheel)

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

Total release size: 27.6 kB

Release files / uistylelang-0.8.5.tar.gz

Download URL uistylelang-0.8.5.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
caab7ef665b4cd974b4d54e3c0a3dfa140d37862644085ff7e76ac833153aa3e
BLAKE2b-256 checksum
How to use checksums
d7c5bb40f4030cc8f4ab7ca43c7f32d3d36a6fa904997539bad08fb6c6c0e0d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Release files / uistylelang-0.8.5-py3-none-any.whl

Download URL uistylelang-0.8.5-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28a7b073bde5877bb598851bad896c48cf6ef8db44bf02e982f02e931dbea536
BLAKE2b-256 checksum
How to use checksums
752c34f896ad00f9cd8ddd979aae457a5b5c73a39fd744e6fa99ac4eae546e93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

0.8.5 This release

2 release files

0.8.0

2 release files

0.5.0

2 release files

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