ich bin recht neu im Programmieren - von der Uni bin ich nur mit C vertraut. Für mein Vorhaben wurde mir Python ans Herz gelegt und ich arbeite mich da so durch.
Nun habe ich lediglich ein Problem:
Tkinter Funktioniert nur mit Python2
Ich habe Python 3.6 mit Tkinter 8.5 installiert.
Auf dem Mac ist Python 2.7.10 standardmäßig installiert gewesen.
Ich bekomme ich unter Python3.6 folgende Fehlermeldung:
Janiss-MBP:~ Janis$ python3 /Users/Janis/Desktop/Python/testprint.py
2018-01-25 14:06:56.788 Python[51398:4967003] -[NSApplication _setup:]: unrecognized selector sent to instance 0x1007b5fa0
2018-01-25 14:06:56.789 Python[51398:4967003] An uncaught exception was raised
2018-01-25 14:06:56.789 Python[51398:4967003] -[NSApplication _setup:]: unrecognized selector sent to instance 0x1007b5fa0
2018-01-25 14:06:56.789 Python[51398:4967003] (
0 CoreFoundation 0x00007fff8f1e84f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8c9d5f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8f2521ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8f158571 ___forwarding___ + 1009
4 CoreFoundation 0x00007fff8f1580f8 _CF_forwarding_prep_0 + 120
5 Tk 0x0000000107a93948 TkpInit + 476
6 Tk 0x0000000107a0ea6e Tk_Init + 1799
7 _tkinter.cpython-36m-darwin.so 0x0000000104fcbdfd Tcl_AppInit + 77
8 _tkinter.cpython-36m-darwin.so 0x0000000104fc9849 _tkinter_create + 889
9 Python 0x000000010006a4c8 _PyCFunction_FastCallDict + 552
10 Python 0x00000001000f3e94 call_function + 612
11 Python 0x00000001000f58a4 _PyEval_EvalFrameDefault + 5604
12 Python 0x00000001000f3230 _PyEval_EvalCodeWithName + 2720
13 Python 0x00000001000f40f7 _PyFunction_FastCallDict + 439
14 Python 0x000000010000e7c4 _PyObject_FastCallDict + 356
15 Python 0x000000010000ee90 _PyObject_Call_Prepend + 208
16 Python 0x000000010000e1b3 PyObject_Call + 99
17 Python 0x00000001000897d1 slot_tp_init + 81
18 Python 0x000000010007ff94 type_call + 212
19 Python 0x000000010000e714 _PyObject_FastCallDict + 180
20 Python 0x00000001000f3cd5 call_function + 165
21 Python 0x00000001000f58a4 _PyEval_EvalFrameDefault + 5604
22 Python 0x00000001000f3230 _PyEval_EvalCodeWithName + 2720
23 Python 0x00000001000f33d4 PyEval_EvalCode + 100
24 Python 0x000000010012ff7e PyRun_FileExFlags + 206
25 Python 0x000000010013021f PyRun_SimpleFileExFlags + 447
26 Python 0x000000010014986a Py_Main + 3914
27 Python 0x0000000100000dfe Python + 3582
28 Python 0x0000000100000c34 Python + 3124
)
2018-01-25 14:06:56.790 Python[51398:4967003] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x1007b5fa0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8f1e84f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8c9d5f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8f2521ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8f158571 ___forwarding___ + 1009
4 CoreFoundation 0x00007fff8f1580f8 _CF_forwarding_prep_0 + 120
5 Tk 0x0000000107a93948 TkpInit + 476
6 Tk 0x0000000107a0ea6e Tk_Init + 1799
7 _tkinter.cpython-36m-darwin.so 0x0000000104fcbdfd Tcl_AppInit + 77
8 _tkinter.cpython-36m-darwin.so 0x0000000104fc9849 _tkinter_create + 889
9 Python 0x000000010006a4c8 _PyCFunction_FastCallDict + 552
10 Python 0x00000001000f3e94 call_function + 612
11 Python 0x00000001000f58a4 _PyEval_EvalFrameDefault + 5604
12 Python 0x00000001000f3230 _PyEval_EvalCodeWithName + 2720
13 Python 0x00000001000f40f7 _PyFunction_FastCallDict + 439
14 Python 0x000000010000e7c4 _PyObject_FastCallDict + 356
15 Python 0x000000010000ee90 _PyObject_Call_Prepend + 208
16 Python 0x000000010000e1b3 PyObject_Call + 99
17 Python 0x00000001000897d1 slot_tp_init + 81
18 Python 0x000000010007ff94 type_call + 212
19 Python 0x000000010000e714 _PyObject_FastCallDict + 180
20 Python 0x00000001000f3cd5 call_function + 165
21 Python 0x00000001000f58a4 _PyEval_EvalFrameDefault + 5604
22 Python 0x00000001000f3230 _PyEval_EvalCodeWithName + 2720
23 Python 0x00000001000f33d4 PyEval_EvalCode + 100
24 Python 0x000000010012ff7e PyRun_FileExFlags + 206
25 Python 0x000000010013021f PyRun_SimpleFileExFlags + 447
26 Python 0x000000010014986a Py_Main + 3914
27 Python 0x0000000100000dfe Python + 3582
28 Python 0x0000000100000c34 Python + 3124
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
Und der Code:
Code: Alles auswählen
import tkinter as tk
fenster = tk.Tk()
fenster.mainloop()
Auf meinem Ubuntu lief übrigens alles. Leider fällt mein Ubuntu Laptop im wahrsten Sinne des Wortes auseinander. Damit ist es schwer zu arbeiten ...