Hi, as part of our software we created xml_wrapper package which allow you creating Tk forms on the fly from xml file.
For example, this xml file will produce form:
<?xml version="1.0" encoding="UTF-8"?> <form> <container type="frame" pos="hor" expand="no"> <line></line> <label>Test Form</label> <line></line> </container> <container type="frame" pos="hor" expand="yes"> <container type="frame" pos="ver" expand="yes"> <container type="frame" pos="hor" expand="yes"> <entry lsize="20" esize="50" var="e1" mandatory="1">Mandatory Entry</entry> <entry lsize="20" esize="50" var="e2">Normal Entry</entry> <entry lsize="20" esize="50" var="e3" state="disabled">Disabled Entry</entry> <entry lsize="20" esize="30" var="e4" mask="integer">Only Number Entry</entry> <line></line> <dropdown lsize="20" esize="30" var="dd1" vtype="list" values="value1 value2 {value with space 3}">DropDown from List</dropdown> <dropdown lsize="20" esize="30" var="dd2" vtype="table" values="client name">DropDown from DBTable</dropdown> <dropdown lsize="20" esize="30" var="dd3" vtype="func" values="return_list">DropDown from Function</dropdown> <line></line> <file lsize="20" esize="30" var="f1">Select File</file> <file lsize="20" esize="30" var="f2" img="black folder.png">Select File Custom Icon</file> <date lsize="20" esize="30" var="date1">Date widget</date> <date lsize="20" esize="30" var="date2" img="black calendar.png">Date Widget Custom Icon</date> <text lsize="20" esize="60" height="4" var="tb1">Text Widget</text> <line></line> <spinbox lsize="20" esize="5" var="sb" min="0" max="100">SpinBox Widget</spinbox> <label_button lsize="20" width="20" btext="Click me" cmd="print_user">Labeled Button Widget</label_button> <label_button lsize="20" img="add.png" cmd="">Labeled Button Widget with image</label_button> <table var="user" headers='"ID" "Username" "Password"' type="table">daidze_user</table> </container> </container> <container type="frame" pos="ver" expand="yes"> <container type="labelframe" pos="hor" expand="yes" label="Labeled frame"> <image var="no_img.png" lsize="15" type="file" framed="yes">Foto</image> <image var="small.png" lsize="15" type="file">Foto</image> <line></line> <bool lsize="20" var="b1">Boolean Widget</bool> </container> </container> </container> <container type="frame" pos="ver" expand="yes"> <line></line> <button img="accept.png" cmd="::xml_wrapper::get_values">Accept</button> <button img="delete.png" cmd="::xml_wrapper::clear_values">Clear</button> </container> </form>
I'm working on adding more widgets, user access rights etc. If somebody interested in such package, just mail me. Tables, dropdowns can get data from PostgreSQL DataBase, function etc.
One more simple usage example:
XML File
<?xml version="1.0" encoding="UTF-8"?> <form> <container type="frame" pos="hor" expand="no"> <line></line> <label>Login</label> <line></line> <entry lsize="15" esize="20" var="username">Username</entry> <entry lsize="15" esize="20" var="password" type="password">Password</entry> <line></line> </container> </form>
How to load it to your application:
package require xml_wrapper set main [frame .main] ::xml_wrapper::load_main /home/user/xml_files login_form.xml $main 1
Result:
coldfiremc - 2022-08-26 01:22:13
No links available