Problema con StringVar y tildes
Publicado por Alma (7 intervenciones) el 13/07/2016 12:23:49
Hola!
Estoy a punto de terminar mi TFG y lo he programado en Python. Para la interfaz gráfica he utilizado Tkinter.
Estoy haciendo pruebas para introducir una palabra en un Entry y al escribir las tildes el programa automáticamente casca, es pulsar la tecla de la tilde y saltar el error sin siquiera pulsar Intro.
Alguien tiene idea de cómo hacer para que el StringVar admita las tildes de antemano o que por lo menos no casque? después el propio programa se encarga de eliminarlas.
Gracias de antemano!
Aquí va el texto del error por si a alguien le sirve de algo:
2016-07-13 12:16:17.102 Python[1181:45619] An uncaught exception was raised
2016-07-13 12:16:17.102 Python[1181:45619] -[__NSCFConstantString characterAtIndex:]: Range or index out of bounds
2016-07-13 12:16:17.102 Python[1181:45619] (
0 CoreFoundation 0x00007fff8c1b94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff81c67f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8c2204bd +[NSException raise:format:] + 205
3 CoreFoundation 0x00007fff8c12ecf6 -[__NSCFString characterAtIndex:] + 102
4 Tk 0x000000010b8499c2 TkpInitKeymapInfo + 751
5 Tk 0x000000010b84fa01 Tk_MacOSXSetupTkNotifier + 880
6 Tcl 0x000000010b3ef56f Tcl_DoOneEvent + 319
7 _tkinter.so 0x000000010ac7ea38 init_tkinter + 9887
8 Python 0x000000010a1c3a0b PyEval_EvalFrameEx + 13400
9 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
10 Python 0x000000010a1c64ae _PyEval_SliceIndex + 342
11 Python 0x000000010a1c330c PyEval_EvalFrameEx + 11609
12 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
13 Python 0x000000010a1bfd8c PyEval_EvalCode + 54
14 Python 0x000000010a1dfa42 PyParser_ASTFromFile + 300
15 Python 0x000000010a1dfae5 PyRun_FileExFlags + 133
16 Python 0x000000010a1df634 PyRun_SimpleFileExFlags + 698
17 Python 0x000000010a1f1011 Py_Main + 3137
18 libdyld.dylib 0x00007fff8b8c25ad start + 1
)
2016-07-13 12:16:17.102 Python[1181:45619] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8c1b94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff81c67f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8c2204bd +[NSException raise:format:] + 205
3 CoreFoundation 0x00007fff8c12ecf6 -[__NSCFString characterAtIndex:] + 102
4 Tk 0x000000010b8499c2 TkpInitKeymapInfo + 751
5 Tk 0x000000010b84fa01 Tk_MacOSXSetupTkNotifier + 880
6 Tcl 0x000000010b3ef56f Tcl_DoOneEvent + 319
7 _tkinter.so 0x000000010ac7ea38 init_tkinter + 9887
8 Python 0x000000010a1c3a0b PyEval_EvalFrameEx + 13400
9 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
10 Python 0x000000010a1c64ae _PyEval_SliceIndex + 342
11 Python 0x000000010a1c330c PyEval_EvalFrameEx + 11609
12 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
13 Python 0x000000010a1bfd8c PyEval_EvalCode + 54
14 Python 0x000000010a1dfa42 PyParser_ASTFromFile + 300
15 Python 0x000000010a1dfae5 PyRun_FileExFlags + 133
16 Python 0x000000010a1df634 PyRun_SimpleFileExFlags + 698
17 Python 0x000000010a1f1011 Py_Main + 3137
18 libdyld.dylib 0x00007fff8b8c25ad start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Estoy a punto de terminar mi TFG y lo he programado en Python. Para la interfaz gráfica he utilizado Tkinter.
Estoy haciendo pruebas para introducir una palabra en un Entry y al escribir las tildes el programa automáticamente casca, es pulsar la tecla de la tilde y saltar el error sin siquiera pulsar Intro.
Alguien tiene idea de cómo hacer para que el StringVar admita las tildes de antemano o que por lo menos no casque? después el propio programa se encarga de eliminarlas.
Gracias de antemano!
Aquí va el texto del error por si a alguien le sirve de algo:
2016-07-13 12:16:17.102 Python[1181:45619] An uncaught exception was raised
2016-07-13 12:16:17.102 Python[1181:45619] -[__NSCFConstantString characterAtIndex:]: Range or index out of bounds
2016-07-13 12:16:17.102 Python[1181:45619] (
0 CoreFoundation 0x00007fff8c1b94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff81c67f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8c2204bd +[NSException raise:format:] + 205
3 CoreFoundation 0x00007fff8c12ecf6 -[__NSCFString characterAtIndex:] + 102
4 Tk 0x000000010b8499c2 TkpInitKeymapInfo + 751
5 Tk 0x000000010b84fa01 Tk_MacOSXSetupTkNotifier + 880
6 Tcl 0x000000010b3ef56f Tcl_DoOneEvent + 319
7 _tkinter.so 0x000000010ac7ea38 init_tkinter + 9887
8 Python 0x000000010a1c3a0b PyEval_EvalFrameEx + 13400
9 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
10 Python 0x000000010a1c64ae _PyEval_SliceIndex + 342
11 Python 0x000000010a1c330c PyEval_EvalFrameEx + 11609
12 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
13 Python 0x000000010a1bfd8c PyEval_EvalCode + 54
14 Python 0x000000010a1dfa42 PyParser_ASTFromFile + 300
15 Python 0x000000010a1dfae5 PyRun_FileExFlags + 133
16 Python 0x000000010a1df634 PyRun_SimpleFileExFlags + 698
17 Python 0x000000010a1f1011 Py_Main + 3137
18 libdyld.dylib 0x00007fff8b8c25ad start + 1
)
2016-07-13 12:16:17.102 Python[1181:45619] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8c1b94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff81c67f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8c2204bd +[NSException raise:format:] + 205
3 CoreFoundation 0x00007fff8c12ecf6 -[__NSCFString characterAtIndex:] + 102
4 Tk 0x000000010b8499c2 TkpInitKeymapInfo + 751
5 Tk 0x000000010b84fa01 Tk_MacOSXSetupTkNotifier + 880
6 Tcl 0x000000010b3ef56f Tcl_DoOneEvent + 319
7 _tkinter.so 0x000000010ac7ea38 init_tkinter + 9887
8 Python 0x000000010a1c3a0b PyEval_EvalFrameEx + 13400
9 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
10 Python 0x000000010a1c64ae _PyEval_SliceIndex + 342
11 Python 0x000000010a1c330c PyEval_EvalFrameEx + 11609
12 Python 0x000000010a1c03c1 PyEval_EvalCodeEx + 1583
13 Python 0x000000010a1bfd8c PyEval_EvalCode + 54
14 Python 0x000000010a1dfa42 PyParser_ASTFromFile + 300
15 Python 0x000000010a1dfae5 PyRun_FileExFlags + 133
16 Python 0x000000010a1df634 PyRun_SimpleFileExFlags + 698
17 Python 0x000000010a1f1011 Py_Main + 3137
18 libdyld.dylib 0x00007fff8b8c25ad start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Valora esta pregunta


0