SpecPython is a GUI-Builder for Python + Tkinter. It is based on
SpecTcl/SpecJava (the gui builder for Tcl).
This is version 0.1 of SpecPython. I wrote it in 2 days, so it is
incomplete. But a lot of things are supported.
I would appreciate any suggestions, bug reports, patches or whatever.
What do you need?
---------------
- SpecJava 0.3 and tcl7.5, tk4.1 or higher with blt
- SpecTcl 1.0 and tcl7.6, tk4.2 or higher
Install:
--------
1) Install SpecJava or SpecTcl
2) Copy python_init.tk into your specjava/spectcl directory
(e.g. /usr/local/lib/SpecTcl).
3) Change the environment variables in specPython.
4) Copy specPython into your bin directory
(e.g. /usr/local/bin).
5) 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 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 0.3 from untitled.py.ui
# Experimental python tk version using the grid geometry manager
import Tkinter; Tk = Tkinter
class untitled (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):
self.input_1 = Tk.StringVar ()
self.input_2 = Tk.StringVar ()
def CreateImages (self, iconPath):
self.__image_runner__ = Tk.PhotoImage ('runner', file = iconPath + '/' + 'runner.gif')
def callback_1 (self):
pass
def callback_2 (self):
pass
def CreateWidgets (self):
self.label_1 = Tk.Label (self, {
'text' : 'label'
})
self.entry_1 = Tk.Entry (self, {
'textvariable' : self.input_1
})
self.listbox_1 = Tk.Listbox (self, {
'height' : '0',
'width' : '0'
})
self.scrollbar_1 = Tk.Scrollbar (self, {
'orient' : 'v'
})
self.label_2 = Tk.Label (self, {
'image' : 'runner',
'text' : 'label'
})
self.entry_2 = Tk.Entry (self, {
'textvariable' : self.input_2
})
self.button_1 = Tk.Button (self, {
'command' : self.callback_1,
'padx' : '11',
'pady' : '4',
'text' : 'button'
})
self.button_2 = Tk.Button (self, {
'command' : self.callback_2,
'padx' : '11',
'pady' : '4',
'text' : 'button'
})
self.listbox_1['yscrollcommand'] = self.scrollbar_1.set
self.scrollbar_1['command'] = self.listbox_1.yview
self.label_1.grid({
'in' : self,
'column' : '1',
'row' : '1',
'sticky' : ''
})
self.entry_1.grid({
'in' : self,
'column' : '2',
'row' : '1',
'sticky' : ''
})
self.listbox_1.grid({
'in' : self,
'column' : '3',
'row' : '1',
'rowspan' : '3',
'sticky' : 'nsew'
})
self.scrollbar_1.grid({
'in' : self,
'column' : '4',
'row' : '1',
'rowspan' : '3',
'sticky' : 'ns'
})
self.label_2.grid({
'in' : self,
'column' : '1',
'row' : '2',
'sticky' : ''
})
self.entry_2.grid({
'in' : self,
'column' : '2',
'row' : '2',
'sticky' : ''
})
self.button_1.grid({
'in' : self,
'column' : '1',
'row' : '3',
'sticky' : ''
})
self.button_2.grid({
'in' : self,
'column' : '2',
'row' : '3',
'sticky' : ''
})
self.rowconfigure (1, {'weight' : 1, 'minsize' : 30})
self.rowconfigure (2, {'weight' : 0, 'minsize' : 30})
self.rowconfigure (3, {'weight' : 0, 'minsize' : 30})
self.columnconfigure (1, {'weight' : 0, 'minsize' : 30})
self.columnconfigure (2, {'weight' : 0, 'minsize' : 30})
self.columnconfigure (3, {'weight' : 0, 'minsize' : 30})
self.columnconfigure (4, {'weight' : 0, 'minsize' : 30})
if __name__ == '__main__':
app = untitled (fill = 'both', expand = 1)
app.mainloop ()
=================================================
I would appreciate any suggestions, bug reports, patches or whatever.
////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|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!
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\////////////////////////////////////////