Code: Alles auswählen
#!/usr/bin/python
# -*- coding: cp1252 -*-
"""
__version__ = "$Revision: 1.3 $"
__date__ = "$Date: 2004/04/14 02:38:47 $"
"""
from PythonCard import model
def schluesseln(eingabe, faktor):
x = list(eingabe)
woerter = eingabe.split()
y = list(u'xyzabcdefghijklmnopqrstuvwxyzabc')
z = list(u'XYZABCDEFGHIJKLMNOPQRSTUVWXYZABC')
k = list(u'89012345678901234567890123456789')
print x
print y
wortnummer = 1
for wort in woerter:
stelle = 0
for buchstabe in x:
print buchstabe
wo = 0
#print 'for x gest'
for buchstver in y:
#print 'for y gest'
print 'xstelle: '+str(stelle)+' '+'xst: '+x[stelle]+' '+y[wo]
if 5 < wo < 31:
if x[stelle] == y[wo]:
#print 'if stelle = wo erfolgr'
x[stelle] = y[wo+wortnummer*faktor]
#print 'xstelle: '+str(stelle)+' '+'xst: '+x[stelle]+' '+'buchst: '+buchstabe+' '+y[wo]
print 'out: ' + x[stelle]+ ' Vers: '+str(wortnummer*faktor)
break
if 5 < wo < 32:
if x[stelle] == z[wo]:
#print 'if stelle = wo erfolgr'
x[stelle] = z[wo+wortnummer*faktor]
print 'out: ' + x[stelle]+ ' Vers: '+str(wortnummer*faktor)
break
if 5 < wo < 32:
if x[stelle] == k[wo]:
#print 'if stelle = wo erfolgr'
x[stelle] = k[wo+wortnummer*faktor]
print 'out: ' + x[stelle]+ ' Vers: '+str(wortnummer*faktor)
break
if wo <= 25:
wo = wo+1
else:
wo = 0
stelle = stelle +1
if wortnummer == 1:
wortnummer = 2
elif wortnummer == 2:
wortnummer = 3
elif wortnummer == 3:
wortnummer = 1
xb = str(''.join(x))
return xb
#self.components.txtdisp.text = xb
class MyBackground(model.Background):
def on_initialize(self, event):
# if you have any initialization
# including sizer setup, do it here
pass
def on_btnverschluesseln_mouseClick(self, event):
self.components.txtdisp.text = schluesseln(self.components.txtdisp.text, -1)
def on_btnentschluesseln_mouseClick(self, event):
self.components.txtdisp.text = schluesseln(self.components.txtdisp.text, 1)
if __name__ == '__main__':
app = model.Application(MyBackground)
app.MainLoop()