Colors: css & themes
Currently, the default css is included in this file. You can easily extend the default style by create a css file in your ~/.pymt/user.css.
Exemple of user.css
* {
/* increase the font-size of every widget */
font-size: 18;
}
Warning
Only class name of widget is currently use to search CSS.
We cannot describe how to style every widget in this class. If you want to known which attribute is needed to style a widget, please look on the widget documentation.
Return a dict() with all the style for the widget.
| Parameters : |
|
|---|
Return the css-ized name of a class (remove the MT prefix, and all in lowercase)
Instance of the CSS sheet
Add a css text to use. Example
mycss = '#buttonA { bg-color: rgba(255, 127, 0, 127); }'
css_add_sheet(mycss)
Add a css file to use. Adds all the css rules in the given file to the pymt css rule set being used
css_add_sheet(cssfile)
Return the css id of a widget
Register a new state
Add a new keyword to be autoconverted when reading CSS. Convert function can be found in parser.py
Register a new prefix
from pymt import *
css_add_file('reload.css')
b1 = MTButton(id='btn1', label='Reload CSS', pos=(100, 100))
b2 = MTButton(id='btn2', label='Button 2', pos=(250, 100))
@b1.event
def on_press(*largs):
css_reload()
w = getWindow()
w.add_widget(b1)
w.add_widget(b2)
runTouchApp()