|
From: Ronald D S. <rd...@ea...> - 2001-09-03 00:58:45
|
PythonCard file, aaa.py
#!/usr/bin/python
"""
__version__ = "$Revision: 1.1 $"
__date__ = "$Date: 2001/08/06 20:32:41 $"
"""
import PythonCardPrototype
from PythonCardPrototype.loader import configOptions
import os, sys
class aaa(PythonCardPrototype.model.Background):
def on_menuFileExit_select(self, menu, event):
self.Close()
def displayResult(self,result):
self.components.sldResult.value=int(result)
def on_sld1_select(self,target,event):
result = self.calcResult()
self.displayResult(result)
def on_bgMin_select(self,target,event):
name = target.name
if name[:3] == 'sld' and int(name[:3]) in [1,2,3,4]:
self.displayResult(self.calcResult())
if __name__ == '__main__':
base, ext = os.path.splitext(sys.argv[0])
filename = base + ".rsrc.py"
configOptions()
app = PythonCardPrototype.model.PythonCardApp(filename)
app.MainLoop()
__________________________________________________________
________________________________________________________
aaa.rsrc.py
{'stack':{'type':'Stack',
'name':'Template',
'title':'Template Resource',
'position':(66, 0),
'size':(500, 600),
'backgrounds': [
{'type':'Background',
'file':'template.py',
'classname':'Template',
'name':'bgTemplate',
'components': [
{'type':'Slider',
'name':'sldResult',
'position':(6, 91),
'size':(200, 20),
'layout':'horizontal',
'max':400,
'min':1,
'value':55,
},
{'type':'Slider',
'name':'sld1',
'position':(9, 160),
'size':(200, 20),
'layout':'horizontal',
'max':100,
'min':1,
'value':55,
},
{'type':'Slider',
'name':'sld2',
'position':(10, 295),
'size':(200, 20),
'layout':'horizontal',
'max':100,
'min':1,
'value':64,
},
{'type':'Slider',
'name':'sld3',
'position':(11, 227),
'size':(200, 20),
'layout':'horizontal',
'max':100,
'min':1,
'value':1,
},
{'type':'Slider',
'name':'sld4',
'position':(10, 9),
'size':(200, 20),
'layout':'horizontal',
'max':100,
'min':1,
'value':28,
},
] # end components
} # end background
] # end backgrounds
} }
attmpt to run results:::
unable to load template.py
Traceback (most recent call last):
File "C:/Python21/PythonCardPrototype/samples/minimal/aaa.py", line 38, in ?
app = PythonCardPrototype.model.PythonCardApp(filename)
File "C:\PYTHON21\PythonCardPrototype\model.py", line 125, in __init__
clazz = module.__dict__[ bg.classname ]
UnboundLocalError: local variable 'module' referenced before assignment
Look, I promise to stop wasting your time soon...
|