https://github.com/pettett/tkinter-xml-markup
xml based UI framework using tkinter for python
https://github.com/pettett/tkinter-xml-markup
custom-widgets python python3 tkinter ui xml
Last synced: 18 days ago
JSON representation
xml based UI framework using tkinter for python
- Host: GitHub
- URL: https://github.com/pettett/tkinter-xml-markup
- Owner: pettett
- License: mit
- Created: 2019-11-10T16:17:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-28T15:00:48.000Z (over 5 years ago)
- Last Synced: 2025-10-29T12:37:31.085Z (7 months ago)
- Topics: custom-widgets, python, python3, tkinter, ui, xml
- Language: Python
- Homepage:
- Size: 2.48 MB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TKML
TKInter for python ui really is kinda bad, so I made this. Uses standard xml markup to map text to tkinter widgets, with support for adding custom widgets and using Textvar and other linked variables as normal python variables.
Custom attributes are labelled below, however all default tkinter args are supported within the attributes, dispite not being labeled below. For example `relief="sunken"` on a frame such as grid or vertical would act the same as a normal tkinter frame
#### Area organisers
* `` Start and end of the xml file structure for the document
* `` Area for xml related to the top tool bar
* `` Main frame
* `minWidth="400"` minimum window width
* `minHeight="400"` minimum window height
#### Toolbar widgets
* `` Toolbar cascade - items within the cascade should be placed as children
* `label="file"` name of cascade
* `` Toolbar seperator
* `` Toolbar command
* `command="OnSave"` event function to call on pressed
* `keybind="*Control-s*"` tkinter binding to place on command
#### Frame layouts
* `` tkinter grid layout
* `` tkinter column configuration
* `column="0"` column index
* `weight="1"` column weight
* `gridy="0"` Children of the grid can use this attribute to change their grid column
* `gridx="0"` Children of the grid can use this attribute to change their grid row
* `` automatically creates a tkinter grid to place children in a vertical list
* `` automatically creates a tkinter grid to place children in a vertical list
#### tkinter Widgets
* `
Hello!
` tkinter label
* `varname="text"` Variable name of text in the label
* `` tkinter entry
* `varname="entry"` Variable name of text in the entry
* `` custom tkinter entry that only accepts floating point entries
* `` custom tkinter entry that only accepts intager entries
* `Enter` tkinter button
* `Check Button`
* ``
* `Radio Option 1`
* `varname="radioGroup1"` Intager variable of selected button - buttons within a group should have the same varname
* `value="1"` starting value
* `Option 1;Option 2;Option 3` tkinter Dropdown box - different elements should be seperated by ; ,as should other elements in widgets that input a list
* `1;2;4;8;16` tkinter spinbox
* `` Each child of the notebook will act as a seperate frame, so children are recommended to be frame types such as grid or vertical
* `tabname="New Tab!"` Children of the notebook can use this to change the title of their tab
* `Default text` tkinter Multiline text editor
* `Default text` tkinter Multiline text editor with auto scroll bar
#### Styles
* `` Style object to set re-occuring args of widgets
* `ref="title"` Name of the style
* `style="title"` Set the style of any element with this attribute (Not to be used within the style object)
* `font.size="16"` Font size (Can also be used in any element with text)
* `font.family="Arial"` Font family (Can also be used in any element with text)
* `font.bold="false"` Font bold (Can also be used in any element with text)
* `font.italic="True"` Font italic (Can also be used in any element with text)
* `font.underline="True"` Font underline (Can also be used in any element with text)
* `font.overstrike="False"` Font overstrike (Can also be used in any element with text)
* `fg="SystemHighlight"` Any tkinter arg can be applied in a style object (Setting the foreground colour here as an example)
#### Custom Widgets
Example: `tkml.TKMLElement("pygameframe", PygameFrame, hasFont=False)` is used in pygame_frame.py to add the custom widget `""` using class PygameFrame.
Use this to add complex custom tk elements while still retaining the simplicity of tkml