Python tkinter: import custom classes into UI class












-2















I've created a simple python program with a UI (tkinter) to show the values from my classifiers. But when I even add the simple import statement at the top of the UI class, the program crashes with the following message:



2019-01-20 22:40:44.988 Python[9783:349120] -[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470
2019-01-20 22:40:44.989 Python[9783:349120] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff785512cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff8d36e48d objc_exception_throw + 48
2 CoreFoundation 0x00007fff785d2f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff784c3755 ___forwarding___ + 1061
4 CoreFoundation 0x00007fff784c32a8 _CF_forwarding_prep_0 + 120
5 Tk 0x0000000103b21c02 TkpInit + 471
6 Tk 0x0000000103a9d2a9 Tk_Init + 1794
7 _tkinter.cpython-36m-darwin.so 0x0000000103975dfd Tcl_AppInit + 77
8 _tkinter.cpython-36m-darwin.so 0x0000000103973849 _tkinter_create + 889
9 Python 0x000000010006a688 _PyCFunction_FastCallDict + 568
10 Python 0x00000001000f33e4 call_function + 612
11 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
12 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
13 Python 0x00000001000f3636 _PyFunction_FastCallDict + 422
14 Python 0x000000010000e984 _PyObject_FastCallDict + 356
15 Python 0x000000010000eaa0 _PyObject_Call_Prepend + 208
16 Python 0x000000010000e5b3 PyObject_Call + 99
17 Python 0x0000000100089871 slot_tp_init + 81
18 Python 0x0000000100080144 type_call + 212
19 Python 0x000000010000e8d4 _PyObject_FastCallDict + 180
20 Python 0x00000001000f3225 call_function + 165
21 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
22 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
23 Python 0x00000001000f2944 PyEval_EvalCode + 100
24 Python 0x000000010012f21e PyRun_FileExFlags + 206
25 Python 0x000000010012f4bf PyRun_SimpleFileExFlags + 447
26 Python 0x0000000100148ada Py_Main + 3914
27 Python 0x0000000100000dfe Python + 3582
28 Python 0x0000000100000c34 Python + 3124
29 ??? 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException


Here is the UI program:



from tkinter import *
from threading import *
from realtime.pose_feature import PostureCalculator



class classifierThread(Thread):
# initialize class

def run(self):
print('')
# start_classifier()


root = Tk()

frame = Frame(root)
frame.pack()

pred_var = StringVar()
posture_var = StringVar()
activity_var = StringVar()

bottomframe = Frame(root)
bottomframe.pack( side = BOTTOM )


lblFinalPrediction = Label(frame, textvariable=pred_var, justify="center")
lblFinalPrediction.config(font=("Courier", 500))
lblFinalPrediction.pack( fill=X,padx=50 )

lblPosture = Label(bottomframe, text="Posture Predictions: ", fg="red")
lblPosture.pack(side = LEFT)

lblPostureResult = Label(bottomframe, textvariable=posture_var, fg="blue")
lblPostureResult.pack( side = LEFT )

lblAction = Label(bottomframe, text="Action Predictions :", fg="brown")
lblAction.pack( side = LEFT )

lblActionResult = Label(bottomframe, textvariable=activity_var, fg="blue")
lblActionResult.pack( side = LEFT )

thread1 = classifierThread()
thread1.start()

root.mainloop()


The imported class is working fine, without giving any error.










share|improve this question



























    -2















    I've created a simple python program with a UI (tkinter) to show the values from my classifiers. But when I even add the simple import statement at the top of the UI class, the program crashes with the following message:



    2019-01-20 22:40:44.988 Python[9783:349120] -[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470
    2019-01-20 22:40:44.989 Python[9783:349120] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470'
    *** First throw call stack:
    (
    0 CoreFoundation 0x00007fff785512cb __exceptionPreprocess + 171
    1 libobjc.A.dylib 0x00007fff8d36e48d objc_exception_throw + 48
    2 CoreFoundation 0x00007fff785d2f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3 CoreFoundation 0x00007fff784c3755 ___forwarding___ + 1061
    4 CoreFoundation 0x00007fff784c32a8 _CF_forwarding_prep_0 + 120
    5 Tk 0x0000000103b21c02 TkpInit + 471
    6 Tk 0x0000000103a9d2a9 Tk_Init + 1794
    7 _tkinter.cpython-36m-darwin.so 0x0000000103975dfd Tcl_AppInit + 77
    8 _tkinter.cpython-36m-darwin.so 0x0000000103973849 _tkinter_create + 889
    9 Python 0x000000010006a688 _PyCFunction_FastCallDict + 568
    10 Python 0x00000001000f33e4 call_function + 612
    11 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
    12 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
    13 Python 0x00000001000f3636 _PyFunction_FastCallDict + 422
    14 Python 0x000000010000e984 _PyObject_FastCallDict + 356
    15 Python 0x000000010000eaa0 _PyObject_Call_Prepend + 208
    16 Python 0x000000010000e5b3 PyObject_Call + 99
    17 Python 0x0000000100089871 slot_tp_init + 81
    18 Python 0x0000000100080144 type_call + 212
    19 Python 0x000000010000e8d4 _PyObject_FastCallDict + 180
    20 Python 0x00000001000f3225 call_function + 165
    21 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
    22 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
    23 Python 0x00000001000f2944 PyEval_EvalCode + 100
    24 Python 0x000000010012f21e PyRun_FileExFlags + 206
    25 Python 0x000000010012f4bf PyRun_SimpleFileExFlags + 447
    26 Python 0x0000000100148ada Py_Main + 3914
    27 Python 0x0000000100000dfe Python + 3582
    28 Python 0x0000000100000c34 Python + 3124
    29 ??? 0x0000000000000002 0x0 + 2
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException


    Here is the UI program:



    from tkinter import *
    from threading import *
    from realtime.pose_feature import PostureCalculator



    class classifierThread(Thread):
    # initialize class

    def run(self):
    print('')
    # start_classifier()


    root = Tk()

    frame = Frame(root)
    frame.pack()

    pred_var = StringVar()
    posture_var = StringVar()
    activity_var = StringVar()

    bottomframe = Frame(root)
    bottomframe.pack( side = BOTTOM )


    lblFinalPrediction = Label(frame, textvariable=pred_var, justify="center")
    lblFinalPrediction.config(font=("Courier", 500))
    lblFinalPrediction.pack( fill=X,padx=50 )

    lblPosture = Label(bottomframe, text="Posture Predictions: ", fg="red")
    lblPosture.pack(side = LEFT)

    lblPostureResult = Label(bottomframe, textvariable=posture_var, fg="blue")
    lblPostureResult.pack( side = LEFT )

    lblAction = Label(bottomframe, text="Action Predictions :", fg="brown")
    lblAction.pack( side = LEFT )

    lblActionResult = Label(bottomframe, textvariable=activity_var, fg="blue")
    lblActionResult.pack( side = LEFT )

    thread1 = classifierThread()
    thread1.start()

    root.mainloop()


    The imported class is working fine, without giving any error.










    share|improve this question

























      -2












      -2








      -2








      I've created a simple python program with a UI (tkinter) to show the values from my classifiers. But when I even add the simple import statement at the top of the UI class, the program crashes with the following message:



      2019-01-20 22:40:44.988 Python[9783:349120] -[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470
      2019-01-20 22:40:44.989 Python[9783:349120] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470'
      *** First throw call stack:
      (
      0 CoreFoundation 0x00007fff785512cb __exceptionPreprocess + 171
      1 libobjc.A.dylib 0x00007fff8d36e48d objc_exception_throw + 48
      2 CoreFoundation 0x00007fff785d2f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
      3 CoreFoundation 0x00007fff784c3755 ___forwarding___ + 1061
      4 CoreFoundation 0x00007fff784c32a8 _CF_forwarding_prep_0 + 120
      5 Tk 0x0000000103b21c02 TkpInit + 471
      6 Tk 0x0000000103a9d2a9 Tk_Init + 1794
      7 _tkinter.cpython-36m-darwin.so 0x0000000103975dfd Tcl_AppInit + 77
      8 _tkinter.cpython-36m-darwin.so 0x0000000103973849 _tkinter_create + 889
      9 Python 0x000000010006a688 _PyCFunction_FastCallDict + 568
      10 Python 0x00000001000f33e4 call_function + 612
      11 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
      12 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
      13 Python 0x00000001000f3636 _PyFunction_FastCallDict + 422
      14 Python 0x000000010000e984 _PyObject_FastCallDict + 356
      15 Python 0x000000010000eaa0 _PyObject_Call_Prepend + 208
      16 Python 0x000000010000e5b3 PyObject_Call + 99
      17 Python 0x0000000100089871 slot_tp_init + 81
      18 Python 0x0000000100080144 type_call + 212
      19 Python 0x000000010000e8d4 _PyObject_FastCallDict + 180
      20 Python 0x00000001000f3225 call_function + 165
      21 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
      22 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
      23 Python 0x00000001000f2944 PyEval_EvalCode + 100
      24 Python 0x000000010012f21e PyRun_FileExFlags + 206
      25 Python 0x000000010012f4bf PyRun_SimpleFileExFlags + 447
      26 Python 0x0000000100148ada Py_Main + 3914
      27 Python 0x0000000100000dfe Python + 3582
      28 Python 0x0000000100000c34 Python + 3124
      29 ??? 0x0000000000000002 0x0 + 2
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException


      Here is the UI program:



      from tkinter import *
      from threading import *
      from realtime.pose_feature import PostureCalculator



      class classifierThread(Thread):
      # initialize class

      def run(self):
      print('')
      # start_classifier()


      root = Tk()

      frame = Frame(root)
      frame.pack()

      pred_var = StringVar()
      posture_var = StringVar()
      activity_var = StringVar()

      bottomframe = Frame(root)
      bottomframe.pack( side = BOTTOM )


      lblFinalPrediction = Label(frame, textvariable=pred_var, justify="center")
      lblFinalPrediction.config(font=("Courier", 500))
      lblFinalPrediction.pack( fill=X,padx=50 )

      lblPosture = Label(bottomframe, text="Posture Predictions: ", fg="red")
      lblPosture.pack(side = LEFT)

      lblPostureResult = Label(bottomframe, textvariable=posture_var, fg="blue")
      lblPostureResult.pack( side = LEFT )

      lblAction = Label(bottomframe, text="Action Predictions :", fg="brown")
      lblAction.pack( side = LEFT )

      lblActionResult = Label(bottomframe, textvariable=activity_var, fg="blue")
      lblActionResult.pack( side = LEFT )

      thread1 = classifierThread()
      thread1.start()

      root.mainloop()


      The imported class is working fine, without giving any error.










      share|improve this question














      I've created a simple python program with a UI (tkinter) to show the values from my classifiers. But when I even add the simple import statement at the top of the UI class, the program crashes with the following message:



      2019-01-20 22:40:44.988 Python[9783:349120] -[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470
      2019-01-20 22:40:44.989 Python[9783:349120] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x102018470'
      *** First throw call stack:
      (
      0 CoreFoundation 0x00007fff785512cb __exceptionPreprocess + 171
      1 libobjc.A.dylib 0x00007fff8d36e48d objc_exception_throw + 48
      2 CoreFoundation 0x00007fff785d2f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
      3 CoreFoundation 0x00007fff784c3755 ___forwarding___ + 1061
      4 CoreFoundation 0x00007fff784c32a8 _CF_forwarding_prep_0 + 120
      5 Tk 0x0000000103b21c02 TkpInit + 471
      6 Tk 0x0000000103a9d2a9 Tk_Init + 1794
      7 _tkinter.cpython-36m-darwin.so 0x0000000103975dfd Tcl_AppInit + 77
      8 _tkinter.cpython-36m-darwin.so 0x0000000103973849 _tkinter_create + 889
      9 Python 0x000000010006a688 _PyCFunction_FastCallDict + 568
      10 Python 0x00000001000f33e4 call_function + 612
      11 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
      12 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
      13 Python 0x00000001000f3636 _PyFunction_FastCallDict + 422
      14 Python 0x000000010000e984 _PyObject_FastCallDict + 356
      15 Python 0x000000010000eaa0 _PyObject_Call_Prepend + 208
      16 Python 0x000000010000e5b3 PyObject_Call + 99
      17 Python 0x0000000100089871 slot_tp_init + 81
      18 Python 0x0000000100080144 type_call + 212
      19 Python 0x000000010000e8d4 _PyObject_FastCallDict + 180
      20 Python 0x00000001000f3225 call_function + 165
      21 Python 0x00000001000f8d84 _PyEval_EvalFrameDefault + 21892
      22 Python 0x00000001000f27a0 _PyEval_EvalCodeWithName + 2720
      23 Python 0x00000001000f2944 PyEval_EvalCode + 100
      24 Python 0x000000010012f21e PyRun_FileExFlags + 206
      25 Python 0x000000010012f4bf PyRun_SimpleFileExFlags + 447
      26 Python 0x0000000100148ada Py_Main + 3914
      27 Python 0x0000000100000dfe Python + 3582
      28 Python 0x0000000100000c34 Python + 3124
      29 ??? 0x0000000000000002 0x0 + 2
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException


      Here is the UI program:



      from tkinter import *
      from threading import *
      from realtime.pose_feature import PostureCalculator



      class classifierThread(Thread):
      # initialize class

      def run(self):
      print('')
      # start_classifier()


      root = Tk()

      frame = Frame(root)
      frame.pack()

      pred_var = StringVar()
      posture_var = StringVar()
      activity_var = StringVar()

      bottomframe = Frame(root)
      bottomframe.pack( side = BOTTOM )


      lblFinalPrediction = Label(frame, textvariable=pred_var, justify="center")
      lblFinalPrediction.config(font=("Courier", 500))
      lblFinalPrediction.pack( fill=X,padx=50 )

      lblPosture = Label(bottomframe, text="Posture Predictions: ", fg="red")
      lblPosture.pack(side = LEFT)

      lblPostureResult = Label(bottomframe, textvariable=posture_var, fg="blue")
      lblPostureResult.pack( side = LEFT )

      lblAction = Label(bottomframe, text="Action Predictions :", fg="brown")
      lblAction.pack( side = LEFT )

      lblActionResult = Label(bottomframe, textvariable=activity_var, fg="blue")
      lblActionResult.pack( side = LEFT )

      thread1 = classifierThread()
      thread1.start()

      root.mainloop()


      The imported class is working fine, without giving any error.







      python tkinter






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 20 at 9:52









      KTBKTB

      60931227




      60931227
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54275264%2fpython-tkinter-import-custom-classes-into-ui-class%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54275264%2fpython-tkinter-import-custom-classes-into-ui-class%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Homophylophilia

          Updating UILabel text programmatically using a function

          Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage