• zencuke102

    Fixed. Thanks to @cvp. Much appreciated. I updated the github version if anyone wants to see a simple example of a custom tableView which each TableViewCell created independenly, each with independently generated content format. Done with simplest python I could think of (no classes etc.) The only complexity is implementing the custom TableView. You can take this as a template and add your own favorite Python complexity. ;-)

    github link to now working file

    posted in Pythonista read more
  • zencuke102

    @cvp That looks good. I did intend to use the prompt as you suggest but I was going to store it in the class I was building which creates the TableViewCell. I didn't get that far in developing the code because I couldn't figure out how to bind an instance method from new()
    which doesn't have an instance (self) pointer. It only gets a class pointer. I'm still confused about new vs init and what you can do in which. (And I should be running this in python 3. I keep forgetting the default is still set to 2.7. I should fix that.)

    It didn't occur to me that I could store data (ie the prompt value) in the Switch instance itself so I don't need to bind the action to a class method. I am still not used to the flexibility of Python. Based on this I really should discard all the new classes in this code except for the data_souce class and focus on storing 'instance' data in the widget objects and then use simple functions as callbacks and to encapsuate whatever functionality is left. And then put all the gui stuff in its own namespace.

    Your other comments are completely valid and I thank you but they are mostly a result of being half way through a code restructure. For example the Number class started as a cut and paste of the other class and I hadn't gotten to updating the TextField action. I've been totally blocked on the action bind problem. I should have created and posted a stripped down version which only showed the action binding error and not waste everyone's time looking at code I already knew was wrong. My apologies.

    Note: Setting Switch.enabled = 0 instead of False may be wrong but it works. ```

    posted in Pythonista read more
  • zencuke102

    @mikael I reread your post and tried again. Print Traceback does show the complete error. Thanks. I had clicked it before but didn't realize it meant "print traceback in console window" even though that is obvious in retrospect. Where else would it print? Thanks again.

    BTW closing the popup doesn't show the console. It just returns to the app. I had to quit the app which returned to the editor, then switch from the editor to the console see the traceback.

    posted in Pythonista read more
  • zencuke102

    @mikael I have modified the callback several ways, guessing what might be wrong. All my guesses so far have failed. I am not experienced enough with python to make good enough guesses. I need the complete error message to make progress. I don't really understand how methods are implemented in python and I've never used lambdas before. The failing line of code combines both of my weak areas.

    posted in Pythonista read more
  • zencuke102

    @mikael thanks. I see the traceback. I should have said that. I clicked all over that error dialog trying to get it to expand the error message. It shows the line of the error. It just doesn't show the complete error message because it doesn't fit in the TextField. So it clips the details of what is wrong and I can't figure it out from the part of the message it does print. And I can't figure out how to override the ui error handler with a handler that fixes this bug. The error happens when the callback is called. The arg list of the callback lambda is wrong so it refuses to call it and throws the exception instead. But the details of what is wrong with the arg list is in the clipped part of the error message.

    I tried to install my own error handler by wrapping the top level view.present() with try...except but the ui built in handler still takes priority and my handler is ignored.

    posted in Pythonista read more
  • zencuke102

    I'm creating a custom TableView but can't figure out how to pass an instance method to Switch.action. I can bind a function but I want to implement multiple rows with the same class and all my attempts fail. I'm trying wrapping the method in a lambda but can't get the args right. The link below fails when a switch is switched. It fails with "TypeError:unbound method checkAction() must be..." The error dialog clips the rest of the message which is not helpful. If I knew what it "must be..." I might be able to fix it. I consider this a bug in the ui error handler. The full error message should be accessable somehow.

    Any hints, either to get a complete error message or to fix the method binding would be greatly appreciated.

    github link to failing file

    posted in Pythonista read more
  • zencuke102

    Could you post an example. I can't quite figure out what you are asking.

    posted in Pythonista read more
  • zencuke102

    I am having problems setting up callback actions in a custom TableView. My biggest problem is that the error messages are often too long to fit in the ui error dialog so they get truncated with ...(elipsis) so I don't know what to fix. I could post the code that fails but first is there anyway to get at the full error message.How do I trap an error calling a lambda in a ui callback. How do I put try catch around that? How do I override the ui builtin error handler.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!