• @JeremyMH a foundation vote that proposed @enceladus but without the editor UI

    import ui class StopWatch(ui.View): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.value = 0 self.state = 'stop' self.update_interval = .1 def draw(self): t0 = (self.value // (600 * 60), self.value // 600, self.value // 10) t1 = (t0[0], t0[1] % 60, t0[2] % 60) ui.draw_string( "{:02}:{:02}:{:02}".format(*t1), font=('Helvetica', 20), rect=(150, 0, 0, 0), color='black', alignment=ui.ALIGN_CENTER) def update(self): if self.state == 'run': self.value += 1 self.set_needs_display() def button_action(sender): v1 = sender.superview['Watch'] sender.hidden = True if sender.title == 'Reset': v1.value = 0 v1.state = 'stop' sender.superview['Start'].hidden = False elif sender.title == 'Start': v1.value = 0 v1.state = 'run' sender.superview['Stop'].hidden = False elif sender.title == 'Stop': v1.state = 'stop' sender.superview['Reset'].hidden = False v = ui.View(width=397, height=271) v.add_subview(StopWatch(name = 'Watch', frame = (0, 30, 345.00, 76.00))) v.present('sheet') for btn in ['Reset', 'Stop', 'Start']: v.add_subview(ui.Button(frame=(v.center.x-40, v.center.y-40, 80, 80), name=btn, border_width=1, corner_radius=40, action=button_action)) v[btn].title = btn if btn != 'Start': v[btn].hidden = True```
  • @DaCondor54, ”...” is just indicating that the code continues, corresponding to the ”>>>” on the first line.

    One space after the dots corresponds to the space between ”>” and ”for” on the first line.

    Thus, indent in respect to the ”f” in ”for” on the first line. If you use 2-space indents, the second line should have 1+ 2 spaces after the dots, the third line 1+ 4, and the last line 1 + 2 again.

  • import ui,sqlite3 database = "database.db" con = sqlite3.connect(database) cursor = con.cursor() users_query = "select * from users" user_sections ="SELECT * FROM users INNER JOIN post on post.user_id = user.id" user_names = [x[1] for x in cursor.execute(users_query)] v = ui.load_view() table = v['table'] table.data_source.items = user_names v.present()

    To add accessories:

    user_names = [{"title":x[1],"accessory_type":"disclosure_indicator"} for x in cursor.execute(users_query)]

  • @mikael @ccc It's working wonders now, thank you! Just a dumb mistake as usual. Great link too!

  • @Luximonsti, you could also share the code you have so far.

  • Hi, I’m back... and yesterday i was recalling this forum, i just came by to tell you my experience.

    *Now it works and was easy to solve but difficult to get it there, because it seems is some app issue. I had to close and re-open the app as if it needs to refresh all variables or objects, idk.
    I noticed it when i was working on this code, it worked okay and then i took a 15mins break, but when i was back to Pythonista; it suddenly stop working... <<why?! If it was already working just fine>> Well i debugged it and i could see ‘contacts.Person()’ fields being changed and ‘saved’ correctly, BUT those updates only showed up within Pythonista, and not in My Contacts app. It was like if Pythonista retrieved all my contacts from a different app or memory.
    Well, after trying changing the code here and there without any success, i just closed the app(slide up) and re-open it, and voila, my code was working again, all contacts’ updates were mirrored in my contacts app.

    Now, the code i was testing and worked fine as example. (You can use get_all_people() instead of find() )

    import clipboard primer_valor_de_lista = 0 curr_cb = clipboard.get() temp_contact = contacts.find('Temporal') person = temp_contact[primer_valor_de_lista] #print(person.first_name) #converted = int(curr_cb) #print(curr_cb) person.phone = [(contacts.MAIN_PHONE, curr_cb)] #temp_contact[primer_valor_de_lista]=person contacts.save() #print(person.phone[0]) Insert Code Here
  • @JonB thank you very much, sir! It did work! Thank you!

  • @felix_42sol_eu and @kjv93 , no need to ask, beta is here

  • I'm pretty sure you can only save in the same folder if you use iCloud. You'd create a folder in iCloud, which should appear to both apps.

  • It worked perfectly!!
    I really appreciate it! Thanks :)

  • @JonB
    understand! i think the just one way to solve this, it's develop a tool for get the real ip and openned doors from a domain or public ip. because utilizing the method gethostbyname('parameter') from lib sockets, maybe i'm wrong, but this method can't show the "real ip" from especified domain.

  • In the console

    import turtle, editor editor.open_file(turtle.__file__)

    This will let you see exactly how turtle was implemented in pythonista.

    Alternatively, here is a modified version that includes pen shapes.

  • Thank you. It can be a great alternative to my problem, you have my thanks @mikael.

  • import ui import time from random import choice class myclass(): def __init__(self): #self.v = ui.load_view('UIwithOtherName.pyui') self.v = ui.load_view() self.v.present('sheet') self.v.name = 'goapp' self.intro() self.key() def intro(self): self.v['textfield1'].text = "The Guitar Oracle is listening." time.sleep(2) def key(self): self.v['textfield1'].text = "Good bye." myclass()
  • Hi @reticulated, I'm quite sure omz is still working on Pythonista because I think it's tremendous (and not very smart) that such an application is abandoned. We should know that he knows this fact (I know he knows this fact).

    I'm happy when people help people with ideas, codes, examples, informations.
    You are talking about things too advanced for me, but I'm sure you are talking in order to give Pythonista more power.

    The nice and curious thing is to understand how to give more power to Pythonista without pretending that is omz to give it (that is without need to compile entire Pythonista for new releases).

    The best thing in my opinion is to give omz maximum freedom to decide when to give us new releases of his great app, and in the meantime people could continue to give more power to Pythonista, maybe with plug-ins development.

    Some ideas:

    to extend functions of code editor with find/replace, reformat, code folding... with one click to extend functions of file browser with find/replace for files and folders and content (with regex), zip compression, full properties on files and folders (size, last edited data, if file is editable or not, so I'd like to block some files or folder by editing them, ... ) to extend functions to link Pythonista to any computer for comfortable development of Pythonista/Python scripts using big pc keyboard (my iphone is little and to use WebIDE) we need a wifi shared, not always available, but maybe with bluetooth could be possible using only pure python libraries or scripts, to extend a possible free remote connection service/interface if you want to make calculations that require not-pure python libraries not present in Pythonista (scipy, pandas, etc..) and with a full and complete integration with the app environment (example: my script, to run, needs some scipy functions, ok, I write it in Pythonista and I execute the entire script with Pythonista interpreter, and only the code that requires scipy is executed by the server with full working input-output capabilities), to extend internal site-packages folder in order to be able to delete not used pure-python libraries, since we can reinstall them with pip (using StaSH for example).

    Thank you

  • @inzel, you cannot find it in pip because it was made by omz, specifically for Pythonista, and thus it is both proprietary and fully dependent on iOS APIs.

    You can try and locate other libraries for other platforms – there’s surely something for webcams out there.

  • @jacobengland16, I use a simple script that uses SSH to send the whole working directory to Raspberry Pi. It then runs the code remotely on the Pi and displays the (textual) results.

    Very handy for when you develop on the iPhone, and want a very tight feedback loop for deployment and testing.

    Let me know if this is relevant and I will share the script.

  • Really impressive. I do not blog, but I am with you in the ”iPhone is my computer” sentiment.

    Do you have any shortcuts for when you just want to update the text of a single article?

Internal error.

Oops! Looks like something went wrong!