• @mikael yes but never finished, I'm sorry to say it, but already far

  • @cvp AWESOME TY! i was going to need this info for item details in my inventory 🙃

  • @robertiii, if the existing layout options do not work for you, you can use cell.content_view as a base and use whatever labels you want. Use tableview.row_height if needed; you can even set it to -1 to have variable-height ”fit to size” rows (check @jonb’s example at the bottom of this thread).

  • @robertiii, set label.number_of_lines = 0, size_to_fit() may also be your friend.

  • Mikael you’re a genius!

  • I think your tread is still running in the UI threadpool and causes the UI to lockup.

    Android will kill your thread if you lock the UI for ~2-3 seconds. AsyncTask will also allow you to display a status bar or spinning ring while the runnable does the work.

  • If you have connected to the peripheral, you implement

    def did_disconnect_peripheral(self, p, error): print('Disconnected, error: %s' % (error,)) % whatever other code goes here

    in theory should work.

    If you have only discivered, but not connected to the peripheral, then you wont get notified, only an error whn you try to connect

  • Thank you!!!!!!!

  • Hi, yes you can' the trick if your using workflow is to use a custom x-success callback that is "args" which will allow pythonista to return the value.

    here is a sample pythonista script that will return a result to workflow.io

    #!/usr/bin/env python # workflow.py import sys,json,urllib from datetime import datetime import console,webbrowser,clipboard def main(): console.clear() console.set_font('Menlo',12) console.set_color(1,1,1) #print json.dumps(sys.argv, indent=4) dtf = '%Y-%m-%d %H:%M:%S' output = dict( when=datetime.now().strftime(dtf), args=sys.argv ) result = json.dumps(output,indent=4) print(result) x_callback=sys.argv[-1] if not '://' in x_callback: return url = x_callback + '?argv=' + urllib.quote(result) webbrowser.open(url) if __name__ == '__main__': main()

    and to call is use this x-callback-url request


    Here is a dropbox link to a workflow.io flow that uses the above pythonista workflow.py code.

    workflow.io to pythonista.py
    Cheers Dave.

  • @robertiii, are you talking about a performance profile for your app?

  • Thank you. I feel like an idiot!!!!! I knew this and went over the code several times. Thank you so much!

  • here is something quick and dirty that updates the level meters within a custom view, and displays the result.
    you could add logic within udate() to check if recorder.peakPowerForChannel_(0) > some threshold, then take some action. the units are dB where -160 is totally quiet, and 0 is max input exceeded.

  • Here's the sample how to use Tab or Enter key on HW keyboard to switch between text fields ...

    import ui _COUNT = 5 class TextFields(ui.View): def __init__(self, **kwargs): super().__init__(**kwargs) self._current_text_field = None self._next_text_field = None self._fields = [ ui.TextField( frame=(12, 12 + (44 + 12) * i, self.bounds.size.width - 12, 44), flex='W', bordered=True, delegate=self, placeholder=f'Index {i}, next index {self._next_field_index(i)}' ) for i in range(_COUNT) ] for x in self._fields: self.add_subview(x) @staticmethod def _next_field_index(index): return index - 1 if index > 0 else _COUNT - 1 def textfield_should_begin_editing(self, textfield): if not self._next_text_field: return True # Tricky part - if you do omit second part of this condition, iOS will INSERT # tab character into your text field instead of switching to another text field. # Basically this method should return True for text field you would like to switch # to AND True for the current text field. Otherwise Tab character will be inserted # as mentioned. # # Try it, remove `or ...` and you'll see how it behaves. return textfield is self._next_text_field or textfield is self._current_text_field def textfield_did_begin_editing(self, textfield): self._next_text_field = self._fields[self._next_field_index(self._fields.index(textfield))] self._current_text_field = textfield def textfield_should_return(self, textfield): self._next_text_field.begin_editing() return True v = TextFields(frame=(0, 0, 500, 500), background_color='white') v.present('sheet')

    ... please, don't forget what @JonB wrote - Pythonista "just" wraps iOS components. If you're lost, consult UIKit reference.

  • Pythonista posted

    Here is a quick example for sending midi from pythonista. I am using MidiFire to process the messages as discussed here. https://audeonic.boards.net/thread/734/adding-scripting-languages-using-midifire. My midifire setup to send out midi consists of an osc block connected to an event monitor connected to a midi output block.

    import socket # addressing information of target #fill in your ip and port IPADDR = '' PORTNUM = 8051 # enter the data content of the UDP packet as hex msg1 = bytearray([0x90, 0x40, 0x60]) msg2 = bytes.fromhex('903e70') #or using variable for midi note message midi_message = '903c50' midi_packet = bytes.fromhex(midi_message) # initialize a socket, think of it as a cable # SOCK_DGRAM specifies that this is UDP s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) # connect the socket, think of it as connecting the cable to the address location s.connect((IPADDR, PORTNUM)) # send the command s.send(midi_packet) s.send(msg1) s.send(msg2) # close the socket s.close()
  • @robertiii no offense, but I would recommend you to read something like How do I ask a good question? and then articles linked at the bottom of this one.

  • I was using a forward slash instead of backslash

Internal error.

Oops! Looks like something went wrong!