[Tkinter] problem

2005-01-29 Thread Club-B42
when i start opt_newlogin.py directly it works fine(outputs '1 1 1 1'),  
but if i start it from options.py there is an error(outputs '').


opt_newlogin.py

from config import *
from Tkinter import *
from opt_newlogin import newlogin
def OptionsWindow():


root = Tk()
root.title(msg_OptionsWindowTitle)
b1 = Button(root, text = msgForgotPassword, width = 40).grid(padx = 5,  
pady = 5, column = 0, row = 0)
b2 = Button(root, text = msgNewLogin, command = newlogin, width =  
40).grid(padx = 5, pady = 5, column = 0, row = 1)

root.mainloop()
if __name__ == '__main__':
OptionsWindow()



options.py

from config import *
from Tkinter import *
import tkMessageBox, os.path
def create_new_account(login, password, secretq, secreta):
print login, password, secretq, secreta
if os.path.exists(os.path.join(data_path, login)):
tkMessageBox.showerror(title = msgError, message =  
msgPasswordLoginExists)
elif login == '':
pass
else:
os.mkdir(os.path.join(data_path, login))
fd = file(os.path.join(data_path, login, data_info_file_name),  
'wb')
fd.write(password + os.linesep)
fd.write(secretq + os.linesep)
fd.write(secreta + os.linesep)
fd.close()
tkMessageBox.showinfo(title = msgInfoAccountCreated, message =  
msgInfoAccountCreated2)

def newlogin():


root = Tk()
root.title(msg_NewLoginWindowTitle)
l1 = Label(root, text = msgLogin).grid(padx = 5, pady = 5, column = 0,  
row = 0, sticky = E)
l2 = Label(root, text = msgPassword).grid(padx = 5, pady = 5, column =  
0, row = 1, sticky = E)
l3 = Label(root, text = msgConfirmPassword).grid(padx = 5, pady = 5,  
column = 0, row = 2, sticky = E)
l4 = Message(root, text = msgKeyQuestion, width = 250).grid(padx = 5,  
pady = 5, column = 0, row = 3, sticky = E)
l5 = Label(root, text = msgKeyQuestionAnswer).grid(padx = 5, pady = 5,  
column = 0, row = 4, sticky = E)

v1 = StringVar()
v2 = StringVar()
v3 = StringVar()
v4 = StringVar()
v5 = StringVar()
e1 = Entry(root, width = 50, textvariable = v1)
e1.grid(padx = 5, pady = 5, column = 1, row = 0)
e1.focus_force()
e2 = Entry(root, width = 50, textvariable = v2, show = '*')
e2.grid(padx = 5, pady = 5, column = 1, row = 1)
e3 = Entry(root, width = 50, textvariable = v3, show = '*')
e3.grid(padx = 5, pady = 5, column = 1, row = 2)
e4 = Entry(root, width = 50, textvariable = v4)
e4.grid(padx = 5, pady = 5, column = 1, row = 3)
e5 = Entry(root, width = 50, textvariable = v5, show = '*')
e5.grid(padx = 5, pady = 5, column = 1, row = 4)
def b1_cmd():
if v2.get()  v3.get():
tkMessageBox.showerror(title = msgError, message =  
msgPasswordConfirmError)
print v1.get(), v2.get(), v4.get(), v5.get()
create_new_account(v1.get(), v2.get(), v4.get(), v5.get())

b1 = Button(root, text = msgCreateNewLoginButton, command =  
b1_cmd).grid(padx = 5, pady = 5, column = 0, row = 5)
b2 = Button(root, text = msgCancelButton, command =  
root.destroy).grid(padx = 5, pady = 5, column = 1, row = 5)

root.mainloop()
if __name__ == '__main__':
newlogin()


config.py

# codepage = cp1251
#
#
#
def u(s):
return unicode(s, 'cp1251')
msgMainWindowTitle  = u('   B 4\\2')
msgLogin= u('')
msgPassword = u('')
msgGameNumber   = u(' ')
msgSaveButton   = u('')
msgLoadButton   = u('')
msgOptionsButton= u('')
msg_OptionsWindowTitle  = u('')
msgForgotPassword   = u(' ')
msgNewLogin = u(' ')
msg_NewLoginWindowTitle = u('  ')
msgConfirmPassword  = u('  ')
msgKeyQuestion  = u('  -
-  ,')
msgKeyQuestionAnswer= u('   ')
msgCreateNewLoginButton = u('')
msgCancelButton = u('')
msgError= u('')
msgPasswordConfirmError = u('  .')
msgPasswordLoginExists  = u('   .')
msgInfoAccountCreated   = u('  ')
msgInfoAccountCreated2  = u('  
   .')

msgInvalidGameNumber= u('  .')
msgInvalidPassword  = u(' .')
msgInvalidLogin = u('  .')
msgSaveError= u('  .')
msgSuccess  = u('')
msgSuccessCopy  = u(' 
,.')

data_path   = '192.168.1.1'
data_info_file_name = 'info'
info_path   = 'info'

--
http://mail.python.org/mailman/listinfo/python-list


py2exe problem

2005-01-25 Thread Club-B42
i've compiled my programm using command python setup.py py2exe 1
python script works fine, but .exe version fails with
=
D:\[Egor]\Scripts\B-4-2\la2luncher\distla2launcher.exe
Traceback (most recent call last):
  File la2launcher.py, line 9, in ?
  File config.pyc, line 11, in ?
  File config.pyc, line 8, in u
LookupError: no codec search functions registered: can't find encoding
=
python 2.3
=
running py2exe
creating D:\[Egor]\Scripts\B-4-2\la2launcher\build
creating D:\[Egor]\Scripts\B-4-2\la2launcher\build\bdist.win32
creating D:\[Egor]\Scripts\B-4-2\la2launcher\build\bdist.win32\winexe
creating  
D:\[Egor]\Scripts\B-4-2\la2launcher\build\bdist.win32\winexe\collect
creating D:\[Egor]\Scripts\B-4-2\la2launcher\build\bdist.win32\winexe\temp
creating D:\[Egor]\Scripts\B-4-2\la2launcher\dist
*** searching for required modules ***
*** parsing results ***
creating D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl
creating D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4
copying C:\Python23\tcl\tcl8.4\auto.tcl -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4
creating D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\ascii.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\big5.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1250.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1251.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1252.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1253.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1254.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1255.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1256.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1257.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp1258.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp437.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp737.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp775.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp850.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp852.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp855.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp857.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp860.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp861.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp862.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp863.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp864.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp865.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp866.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp869.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp874.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp932.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp936.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp949.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\cp950.enc -  
D:\[Egor]\Scripts\B-4-2\la2launcher\dist\tcl\tcl8.4\encoding
copying C:\Python23\tcl\tcl8.4\encoding\dingbats.enc -