SpecPython is a GUI-Builder for Python + Tkinter. It is based on
SpecTcl/SpecJava (the gui builder for Tcl/Java).
This is version 0.2 of SpecPython. It was written originally by
Andreas Koschinsky (mailto:
[email protected]) in 2 days, so it is
incomplete. But a lot of things are supported.
This version has been updated to support SpecTcl1.1. It has been
tested with Python 1.5.1, and Tcl8.1, Tk8.1. But it should work
with Tcl7.6/Tk4.2 and higher.
Updates to the code were made by Richard Colley
(mailto:
[email protected]) and were based on SpecPerl1.0
by Mark Kvale (mailto:
[email protected]) and Warren Jones.
The latest version should be available from
ftp://ftp.python.org/pub/python/contrib/Graphics/Tkinter/SpecPython*
I would appreciate any suggestions, bug reports, patches or whatever.
What do you need?
---------------
- Python 1.5 or higher (maybe 1.4 works too?)
- SpecTcl 1.1
- tcl7.6, tk4.2 or higher
Install:
--------
0) Install Python (
http://www.python.org)
1) Install SpecTcl1.1 (
http://sunscript.sun.com/spectcl/)
2) unpack the SpecPython archive:
cd /tmp
gunzip -c <SpecPython0.2.tgz | tar xvf -
3) Update SpecTcl preferences.tk
cd {SpecTcl1.1 InstallDir}/SpecTcl
mv preferences.tk preferences.tk.orig
cp /tmp/SpecPython0.2/preferences.tk .
4) Copy python_init.tk into your SpecTcl directory
cd {SpecTcl1.1 InstallDir}/SpecTcl
cp /tmp/SpecPython0.2/python_init.tk .
5) Change the environment variables in /tmp/SpecPython0.2/bin/specPython.
4) Copy .../bin/specPython into your path
(e.g. /usr/local/bin).
6) OPTIONAL: Copy SpecTclrc into your home directory.
SpecTclrc contain a bit of code that creates tcl images for all gif
files in your current directory. It creates an images with the name x
if the name of the image file is x.gif. You can use these images in
SpecPython.
Features:
---------
SpecPython creates:
- a python source file. The name of the generated file is
the SpecTcl project file name (e.g. blah) with "_ui.py"
appended.
- a class. You should inherit you application class from this
class.
- instances for all specified variables with StringVar ().
- images for all specified images.
- empty callback for each command.
- all widgets.
- the scrollbar/listbox connections
Examples:
---------
SpecPython generates code like this:
====================================
# generated by SpecPython
# interface generated by SpecTcl version 1.1 from stat_list.ui
# Experimental python tk version using the grid geometry manager
import Tkinter; Tk = Tkinter
class stat_list (Tk.Frame):
def __init__ (self, master = None, iconPath = '.', **packOptions):
Tk.Frame.__init__ (self, master)
self.CreateVariables ()
self.CreateImages (iconPath)
self.CreateWidgets ()
self.pack (packOptions)
def CreateVariables (self):
pass
def CreateImages (self, iconPath):
pass
def CreateWidgets (self):
self.label_1 = Tk.Label (self, {
'font' : '-*-interface user-Bold-R-Normal-*-*-140-*-*-*-*-*-*',
'text' : 'Object'
})
self.label_2 = Tk.Label (self, {
'font' : '-*-interface user-Bold-R-Normal-*-*-140-*-*-*-*-*-*',
'text' : 'Sub-type'
})
self.label_3 = Tk.Label (self, {
'font' : '-*-interface user-Bold-R-Normal-*-*-140-*-*-*-*-*-*',
'text' : 'Statistics'
})
self.listbox_1 = Tk.Listbox (self, {
'height' : '0',
'width' : '0'
})
self.scrollbar_1 = Tk.Scrollbar (self, {
'orient' : 'v'
})
self.listbox_2 = Tk.Listbox (self, {
'height' : '0',
'width' : '0'
})
self.scrollbar_2 = Tk.Scrollbar (self, {
'orient' : 'v'
})
self.listbox_3 = Tk.Listbox (self, {
'font' : '-*-interface user-Medium-R-Normal-*-*-120-*-*-*-*-*-*',
'height' : '3',
'selectmode' : 'extended',
'width' : '4'
})
self.scrollbar_3 = Tk.Scrollbar (self, {
'orient' : 'v'
})
self.listbox_1['yscrollcommand'] = self.scrollbar_1.set
self.scrollbar_1['command'] = self.listbox_1.yview
self.listbox_2['yscrollcommand'] = self.scrollbar_2.set
self.scrollbar_2['command'] = self.listbox_2.yview
self.listbox_3['yscrollcommand'] = self.scrollbar_3.set
self.scrollbar_3['command'] = self.listbox_3.yview
self.label_1.grid({
'in' : self,
'column' : '2',
'row' : '2',
'sticky' : ''
})
self.label_2.grid({
'in' : self,
'column' : '5',
'row' : '2',
'sticky' : ''
})
self.label_3.grid({
'in' : self,
'column' : '8',
'row' : '2',
'sticky' : ''
})
self.listbox_1.grid({
'in' : self,
'column' : '2',
'row' : '3',
'sticky' : 'nesw'
})
self.scrollbar_1.grid({
'in' : self,
'column' : '3',
'row' : '3',
'sticky' : 'nesw'
})
self.listbox_2.grid({
'in' : self,
'column' : '5',
'row' : '3',
'sticky' : 'nesw'
})
self.scrollbar_2.grid({
'in' : self,
'column' : '6',
'row' : '3',
'sticky' : 'nesw'
})
self.listbox_3.grid({
'in' : self,
'column' : '8',
'row' : '3',
'sticky' : 'nesw'
})
self.scrollbar_3.grid({
'in' : self,
'column' : '9',
'row' : '3',
'sticky' : 'nesw'
})
self.rowconfigure (1, {'weight' : 0, 'minsize' : 10})
self.rowconfigure (2, {'weight' : 0, 'minsize' : 37})
self.rowconfigure (3, {'weight' : 1, 'minsize' : 254})
self.rowconfigure (4, {'weight' : 0, 'minsize' : 11})
self.columnconfigure (1, {'weight' : 0, 'minsize' : 10})
self.columnconfigure (2, {'weight' : 1, 'minsize' : 218})
self.columnconfigure (3, {'weight' : 0, 'minsize' : 2})
self.columnconfigure (4, {'weight' : 0, 'minsize' : 17})
self.columnconfigure (5, {'weight' : 1, 'minsize' : 225})
self.columnconfigure (6, {'weight' : 0, 'minsize' : 2})
self.columnconfigure (7, {'weight' : 0, 'minsize' : 37})
self.columnconfigure (8, {'weight' : 1, 'minsize' : 358})
self.columnconfigure (9, {'weight' : 0, 'minsize' : 2})
self.columnconfigure (10, {'weight' : 0, 'minsize' : 10})
if __name__ == '__main__':
app = stat_list (fill = 'both', expand = 1)
app.mainloop ()
Original SpecPython author:
---------------------------
////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|Andreas Koschinsky|email:
[email protected]|
|logware GmbH|Schwedenstr. 9|13359 Berlin|phone: +49 30 49901-243|fax: -139|
--------------------------------------------------------------------------------
She's not truly a Bundy. You see, your mother is just a Bundy by marriage.
She's part of the curse. But we are blood Bundies. We are truly doomed!
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\////////////////////////////////////////
Update author to SpecPython0.2:
-------------------------------
[email protected]