• from objc_util import * import ui def touchesBegan_withEvent_(_self,_cmd,touch,event): print('TOUCH ********\n', ObjCInstance(touch)) print('EVENT ********\n', ObjCInstance(event)) MyGestureRecognizer=create_objc_class('MyGestureRecognizer',ObjCClass('UIGestureRecognizer'), methods=[touchesBegan_withEvent_]) g=MyGestureRecognizer.new() v=ui.View() v.objc_instance.gestureRecognizers=ns([g]) v.touch_enabled=True v.present('sheet')

    here is how you would get started.. you then have to figure out which methods you want to implement, and implement those.

  • as I understand your code, it is not that data is getting duplicated, but you are using the same touch instance, since the touch Id is the same -- i.e you are updating the touch object, but not creating a new one. really, I think you sort of want to compute the rotation, etc parameters for each state, when the state object gets created, rather than manipulating the touch object in Data. Dunno.

    btw, the python built in debugger is called pdb, and does let you single step code, look at variables in real time, etc. But it is not really useful within scene, since it is console based. I am not sure if scene is compatible with the long press to set breakpoints in the python ista debugger.

  • Thanks to zrzka for a working solution!

    I functionized his answer here:

    def superscript(view, itemName, text, size, offset, startPos, length): #Get the UI object by name from the current UI view target_ui_item = view[itemName] #Create a obj-c Mutable Attributed String object and initialize with text NSMutableAttributedString = ObjCClass('NSMutableAttributedString') attributed_string = NSMutableAttributedString.alloc().initWithString_(ns(text)) range = NSRange(startPos, length) #Create an obj-c Font UIFont = ObjCClass('UIFont') #Define a List (?) of attributes attributes = { ns('NSFont'): UIFont.systemFontOfSize(size), ns('NSBaselineOffset'): ns(offset) } #Set the specific attributes of a specific range of the NS Mutable Attributed String attributed_string.setAttributes_range_(attributes, range) # ui_item_objc = ObjCInstance(target_ui_item) UIButton = ObjCClass('UIButton') for subview in ui_item_objc.subviews(): if subview.isKindOfClass(UIButton): subview.setAttributedTitle_forState_(attributed_string, 0)

    Into this function, you should pass your current UI.View containing the UI element (in my case a button) which you want the superscripted string.
    The second argument is the name of the UI element, in my case 'x_squared' <- the name of my button
    The third argument is the text string that you want printed, in my case 'x2'
    The fourth argument is the font size of the base character (I used 16)
    The fifth arg is the offset for how high (or low, use negative) to offset the smaller character (I used 8)
    The sixth arg is the string position to start the superscript string, (for me that was char 1)
    The final arg is the length of the superscripted string (also 1 for me)
    So the final call to this function looked like this (see first line below)

    The second line below did a log base 10 string (slightly more complex call than an "x squared" button

    superscript(self, 'x_squared', 'x2', 16, 8, 1, 1) superscript(self, 'log_base_ten', 'log10', 16, -10, 3, 2)

    Hope this helps anyone who might need this in the future!
    Thanks to everyone who helped me!

Internal error.

Oops! Looks like something went wrong!