NSTableView with pyObjc

Discussion in 'Mac Programming' started by 990adjustments, Oct 6, 2008.

  1. 990adjustments macrumors newbie

    Mar 21, 2008
    Need a bit of help because I hit a brick wall. Since it's my first post, a quick intro is in order.

    I'm not a programmer by any means. I am a designer/3D Animator who likes to dabble in programming. Really basic command line stuff and a bit of python.

    I'm creating a simple app using pyObjc and cocoa as a learning exercise but not sure how to tackle this problem. I have two python lists and a two column table in my gui. I would like to send the items in one list to one column and the items in the second list to the second column in the table.

    I am using an array controller in IB and binding/key-value coding. The docs/tutorials I have read say I have to supply a list of dicts to the table but that does not work for me. One, I'm having a hard time combining two lists to create a proper dict that the table will accept. I did use dict(zip(list1,list2) to combine the two lists to form the data structure but that didn't work. Still reading up on all this stuff so bare with me. I tried using two array controllers to send the data to each column but no go. Is that even possible?

    Any suggestions or pointers on how I would go about this. The app basically just takes a file and renames it. So I would like to show the unmodified file in one column and the modified file in the second column.

    Again, sorry if it's an obvious solution but just getting my feet wet here.


  2. MacRumors Guy macrumors member

    Sep 17, 2008
    Hi, I think you can't use Python dicts or lists when an NSArray* or NSDict* is expected. Fortunately you can create instances of both classes from python. Also python data structures can't be observed via key value coding.

Share This Page