@foundjem
No, it does not.
So I use 'carnets' app which has support of most modules including pandas.
carnets is jupyter notebooks on iOS, it is great and free.. a little quirky, though :)
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.

Best posts made by ramvee
-
RE: Pandas support?
-
RE: Help regarding - cannot import name 'pyplot' error
Thank you very much @ccc for your constant support and prompt help.
Yes, I found some old file, i had named matplotlib.py ,
I have renamed it and now everything works fine.
Silly mistake on my part when i started with pythonista. -
RE: Pythonista is now featured on Python.org
Congratulations @omz .. Well Deserved!
No Better App Than Pythonista, To Learn Python.. On iOS! -
Modules Of Pythonista Displayed With Help
Hi,
I wanted a list of modules importable in Pythonista and display corresponding help() text.
As i found help() spewing out text to console for each module cumbersome, i wrote this snippet.
I am sure there must be better ways to doing this. But I am just learning, and
it works :)
Also I learned a little bit about stdout, pkgutil, StringIO in this process.
More Power To Pythonista!# View help text for all the importable modules # using StringIO # Edited based on suggestions by @shtek & @Phuket2 # Edited to make use of contextlib.redirect_stdout # coding: utf-8 import ui, pkgutil from io import StringIO from contextlib import redirect_stdout w, h = ui.get_screen_size() fontsize = 15 if w > 767: fontsize = 24 if w > 1500: fontsize = 36 modulelist = [] for pkg in pkgutil.iter_modules(): modulelist.append(pkg[1]) def load_action(sender): ttval = (ttableview1.data_source.items[sender.selected_row]) # redirecting output using contextlib.redirect_stdout help_str = StringIO() with redirect_stdout(help_str): help(ttval) helptext = help_str.getvalue() ttextview1.text = helptext ttextview1 = ui.TextView(name='ttextview1', frame=(w * .3, 0, w * .7, h * .9), flex='WH', text='Click Any Module On Left', border_width=1, border_color=0, font=('<system>', fontsize), bg_color = 'lightyellow', text_color = 'red') ttextview1.editable = False ttableview1 = ui.TableView(name='ttableview1', frame=(0, 0, w * .3, h * .9), flex='HR', border_width=1, border_color=0, row_height=h / 20, seperator_color = 'red', alpha = .8) list_source = ui.ListDataSource(sorted(modulelist)) list_source.font = ('Avenir Next Condensed', fontsize) list_source.text_color = 'red' list_source.highlight_color = 'yellow' ttableview1.data_source = ttableview1.delegate = list_source ttableview1.data_source.action = load_action vname = str(len(modulelist)) + ' Modules' view = ui.View(name=vname, bg_color = 'yellow', frame=(0, 0, w, h * .9)) view.add_subview(ttableview1) view.add_subview(ttextview1) view.present(title_bar_color = 'yellow')
-
RE: How do I access a gui element?
@Phuket2,
Thank you for the info, will try and understand what this is about!
Admire you for your helping nature!
Namaste! -
RE: How do I access a gui element?
Hi @pyfonista,
I am a beginner myself, but hope this helps.
Note your my_gui.pyui file should have 3 buttons with their action as, small_tapped, medium_tapped and large_tapped. Also you must have a textfield1 to print the status of which button is pressed.import ui def small_tapped(sender): sender.superview['textfield1'].text= 'Small' def medium_tapped(sender): sender.superview['textfield1'].text= 'Medium' def large_tapped(sender): sender.superview['textfield1'].text= 'Large' def main(): ui.load_view('my_gui').present('sheet') main()
-
RE: Using delete in ui.Tableview
I found this example useful. Hope it helps.
https://forum.omz-software.com/topic/1524/simple-demo-of-tableview-logic-for-the-novices
-
RE: Beginner help on updating table data
Hi @Phuket2 ,
Thank You Very Much, My Friend.
'Super' Prompt In Helping!
This 'Super' View Always Gets Me!
Like You Said I Am Sure There Are Far Better Ways Of Doing The Same.
Learning Slowly.. :) -
RE: Simple UI tutorial?
Hi @Bjucha ,
I am a beginner too.
And made this small label program to
understand UI Module and Label Creation with position.
I find UI Module's learning curve steep, but UI Module is vital to use Pythonista on the iOS devices.
Hope this helps# Learning Alignment Options In UI # Pythonista # Flex LRTBWH import ui w,h = ui.get_screen_size() h = h - 64 view = ui.View(name = 'Flex', bg_color = 'lightyellow', frame = (0,0,w,h)) #view.flex = 'WH' # label height and button width bh = bw = 80 # margin mg = 10 lb1 = ui.Label(name = 'Label1', bg_color = 'yellow', frame =(mg,mg,bw,bh)) lb1.border_color = 'black' lb1.border_width = 1 lb1.flex = 'RB' lb1.alignment=1 lb1.text = lb1.flex lb2 = ui.Label(name = 'Label2', bg_color = 'yellow', frame =(w-(bw+mg),mg, bw,bh)) lb2.border_color = 'black' lb2.border_width = 1 lb2.flex = 'LB' lb2.alignment=1 lb2.text = lb2.flex lb3 = ui.Label(name = 'Label3', bg_color = 'yellow', frame =(mg,h-(bh+mg),bw,bh)) lb3.border_color = 'black' lb3.border_width = 1 lb3.flex = 'RT' lb3.alignment=1 lb3.text = lb3.flex lb4 = ui.Label(name = 'Label4', bg_color = 'yellow', frame =(w-(bw+mg),h-(bh+mg),bw,bh)) lb4.border_color = 'black' lb4.border_width = 1 lb4.flex = 'LT' lb4.alignment=1 lb4.text = lb4.flex # center lb5 = ui.Label(name = 'Label5', bg_color = 'yellow', frame =((w-bw)*.5,(h-bh)*.5,bw,bh)) lb5.border_color = 'black' lb5.border_width = 1 lb5.flex = 'LRTB' lb5.alignment=1 lb5.text = lb5.flex view.add_subview(lb1) view.add_subview(lb2) view.add_subview(lb3) view.add_subview(lb4) view.add_subview(lb5) view.present('screen')
-
RE: Prime number finder
More efficient way would be to check the number for divisibility, only till its' square root - 1.
Because the largest factor of any number cannot exceed it's square root, there is no need for range to go beyond that.
With minimal alteration to script given by @ccc , this would be more efficient.# Revised as per bug reported by @cvp # This code takes care of numbers 1 and 2 also. import time from math import sqrt print('Made by Yasas Kulatunga, Dhari Prashanth and Dhivy Prashanth') print(' ') number = int(input("Enter a Number: ").strip()) maxfact = int(sqrt(number)+1) print(' ') time.sleep(0.5) print('THINKING.') time.sleep(0.5) print('THINKING..') time.sleep(0.5) print('THINKING...') time.sleep(0.5) print(' ') while number: for i in range(2, maxfact): if number % i == 0: print('{} is not prime.'.format(number)) break else: print('{} is prime!'.format(number)) number = int(input("Enter a Number: ").strip()) maxfact = int(sqrt(number)+1)
Latest posts made by ramvee
-
RE: Learn Piano Notes With Tempo Setting
Thank You @ccc .
You're always there :)
And I'm sure, you can reduce this code by half ! -
Learn Piano Notes With Tempo Setting
Hi Friends,
After a long time, I was writing code in pythonista, to help learn, playing piano notes.
I am sure this may not be the optimal solutiion. But it works, and I am always ready to
learn from the experts here. Thank You!# to learn playing piano keys from phone display # not scaled for ipad import ui import sound import time from random import choice from scripter import script, start_scripter td=1 # default time delay 1 sec # piano keys from A3 to G4# are Available with following names (21 keys) piano_klist = [ "piano:C3", "piano:C3#", "piano:D3", "piano:D3#", "piano:E3", "piano:F3", "piano:F3#", "piano:G3", "piano:G3#", "piano:A3", "piano:A3#", "piano:B3", "piano:C4", "piano:C4#", "piano:D4", "piano:D4#", "piano:E4", "piano:F4", "piano:F4#", "piano:G4", "piano:G4#" ] # to load sound effects for minimum latency for key_name in piano_klist: sound.load_effect(key_name) def slider_action(sender): global td # to set slider value reversed, so that # bpm can go up sliding towards right td = round(((1-sender.value)*1.75)+0.2, 2) bpm=int (60/td) lb.text= str(bpm) + ' BPM' # I put this here hoping it will avoid keyboard popping up # and covering the display area ui.end_editing() # very important to update label with name of music note @script def rnd_note(sender): # set to practice for 12 notes at a time repeat = 12 for note in range(repeat): key_name = choice(piano_klist) time.sleep(td) lb1.text = key_name[6:] sound.play_effect(key_name) yield time.sleep(td) lb1.text = '♫' lb.text = 'Tempo Slider' w,h = ui.get_screen_size() # if in landscape mode if w>h: w,h=h,w gap = 10 v = ui.View(name='Piano Practice', bg_color = 'lightyellow') v.frame = (gap,gap,w,h) start_scripter(v) lb = ui.Label(name = 'mylabel') lb.frame=(gap*2, 10, w-4*gap, 30) lb.background_color='gray' lb.text_color = 'yellow' lb.font = ('Helvetica', 18) lb.text = 'Set Tempo BPM' lb.alignment =1 lb.flex = 'W' slider = ui.Slider() slider.value=0.5 slider.frame=(gap*2,gap+32,w-4*gap,50) slider.background_color='gray' slider.flex = 'W' slider.action = slider_action lb1 = ui.Label(name = 'note') lb1.frame= (gap*2, gap+100, w-4*gap, h-475) lb1.font = ('Helvetica', 150 ) lb1.text_color = 'yellow' lb1.alignment =1 lb1.background_color = 'gray' lb1.text = '♫' lb1.flex = 'W' button = ui.Button(name='start') button.frame = (gap*2, 300, w-4*gap, 40) button.bg_color='yellow' button.border_width=1 button.title='Start' button.font = ('Helvetica', 18) button.flex = 'W' button.action=rnd_note v.add_subview(slider) v.add_subview(lb) v.add_subview(lb1) v.add_subview(button) v.present('sheet')
-
RE: Carnets
I use both Carnets and Pyto, and love both of them.
But I am not an advanced user so they help me learn Jupiter Notebooks (Carnets)
And both can run Pandas, which is superb.
Pyto is updated regularly and runs 3.8 version of Python -
RE: Does Pythonista work on iPadOS?
I Am Using Pythonista On My iPad Pro And I Have No Issues At All, It Works Fine.
-
RE: Python iOS app
I love Pythonista, and learned a lot of Python on the go..
Apart from pythonista, i am enjoying Pyto (with Python3.8) and Carnets (Like Jupyter Notebooks), especially, as both of these work with Pandas. -
RE: Tableview updating data while using a filter
Thank you @cvp for all your help and @Phuket2 for filtering code.
I have put up the fully working version below.
I use this to order a lot of books for our bookstore.
I have the csv data file with a few thousand records of book title and book author.import ui items = [ ['Pretty Woman', 'Julia Roberts'], ['Seven Year Itch', 'Marilyn Monroe'], ['Casablanca' , 'Ingrid Bergman'], ['Roman Holiday','Audrey Hepburn'], ['African Queen','Katherine Hepburn'], ['Out Of Africa','Meryl Streep'], ['Cleopatra','Elizabeth Taylor'], ['Titanic','Kate Winslet'], ['Apartment','Shirley MacLaine'], ['West Side Story','Natalie Wood'], ['Rear Window','Grace Kelly'], ['Pillow Talk','Doris Day'], ['Sound Of Music','Julie Andrews'], ['Love Story','Ali McGraw'], ['You Got Mail','Meg Ryan'], ['Clueless','Alicia Silverstone'], ['Great Gatsby','Mia Farrow'], ['Mask','Cameron Diaz'], ['Kill Bill', 'Uma Thurman'], ] w,h = ui.get_screen_size() h=h-64 gap = 5 fontsize = 15 if w<750 else int((w / 75) + 16) class MyTableViewDataSource (object): def tableview_cell_for_row(self, tableview, section, row): row_title, row_description = tableview.data_source.items[row] # 'subtitle'-style cells come with a built-in secondary label cell = ui.TableViewCell('subtitle') cell.text_label.text = row_title cell.text_label.text_color = 'blue' cell.detail_text_label.text = row_description cell.detail_text_label.text_color = 'slateblue' return cell def tableview_number_of_rows(self, tableview, section): return len(tableview.data_source.items) class MyTableViewDelegate (object): def tableview_did_select(self, tableview, section, row): main, desc = tableview.data_source.items[row] print(f'{main}, {desc}') class MyTextFieldDelegate (object): items = items or [] def textfield_did_change(self, textfield): self.filter_data(textfield.text) def filter_data(self, filter_text=''): ft = filter_text.lower() if not len(ft): tbl.data_source.items = self.items tbl.reload() else: tbl.data_source.items = [s for s in self.items if (ft in s[0].lower()) or (ft in s[1].lower())] tbl.reload() view = ui.View(name='Filter Items', frame =(0,0,w,h), bg_color='slateblue') tf = ui.TextField(frame=(gap,gap,w-gap*2,32), flex='w', placeholder='Search', clear_button_mode='always') tf.delegate = MyTextFieldDelegate() view.add_subview(tf) tbl = ui.TableView(frame=(gap,42,w-gap*2,h-42), corner_radius=3, flex='wh') tbl.row_height=fontsize*2.5 tbl.name = 'Item Table' tbl.separator_color = 'grey' tbl.data_source = MyTableViewDataSource() tbl.data_source.items = items tbl.delegate = MyTableViewDelegate() view.add_subview(tbl) view.present('sheet', title_bar_color= 'slateblue')
-
RE: Tableview updating data while using a filter
Thank You Very Much For The Prompt Reply @cvp !
I can figure it out now. :) -
RE: Pandas support?
@foundjem
No, it does not.
So I use 'carnets' app which has support of most modules including pandas.
carnets is jupyter notebooks on iOS, it is great and free.. a little quirky, though :) -
Tableview updating data while using a filter
Hi Friends,
I am trying to use a filter which must update the data source continuously in my tableview.
I figured it out for ui.LitsDataSource but i have wasted a couple of days trying to do the same with
MyTableViewDataSource method.
This filter was shown by a kind friend @Phuket2 about 2 years ago.
It was must a very simple mistake i am making, tried using reload() method too.
Here is my program, forgive the sloppiness..
Thank you.# filtering data with two items per record # example with tableview cells with subtitles # And TableView Delegate method import ui items = [ ['Pretty Woman', 'Julia Roberts'], ['Seven Year Itch', 'Marilyn Monroe'],['Casablanca' , 'Ingrid Bergman'], ['Roman Holiday','Audrey Hepburn'], ['Sound Of Music','Julie Andrews'], ['Love Story','Ali McGraw'], ['You Got Mail','Meg Ryan'], ['Clueless','Alicia Silverstone'], ['Great Gatsby','Mia Farrow'], ['Mask','Cameron Diaz'] ] w,h = ui.get_screen_size() h=h-64 gap = 5 fontsize = 15 if w<750 else int((w / 75) + 16) def reload_data(): tbl.data_source.reload() class MyTableViewDataSource (object): def tableview_cell_for_row(self, tableview, section, row): row_title, row_description = items[row] # 'subtitle'-style cells come with a built-in secondary label cell = ui.TableViewCell('subtitle') cell.text_label.text = row_title cell.text_label.text_color = 'blue' cell.detail_text_label.text = row_description cell.detail_text_label.text_color = 'slateblue' #'#555' return cell def tableview_number_of_rows(self, tableview, section): return len(items) class MyTableViewDelegate (object): def tableview_did_select(self, tableview, section, row): print(f'{items[row][0]}, {items[row][1]}') class MyTextFieldDelegate (object): items = items or [] def textfield_did_change(self, textfield): self.filter_data(textfield.text) def filter_data(self, filter_text=''): ft = filter_text.lower() if not len(ft): tbl.data_source.items = self.items else: for s in self.items: if ft in (s[0].lower()) or ft in (s[1].lower()): tbl.data_source.items = s ## Need this to be updated ## in the tableview view = ui.View(name='Filter Items', frame =(0,0,w,h), bg_color='slateblue') tf = ui.TextField(frame=(gap,gap,w-gap*2,32), flex='w', placeholder='Search', clear_button_mode='always') tf.delegate = MyTextFieldDelegate() view.add_subview(tf) tbl = ui.TableView(frame=(gap,42,w-gap*2,h-42), corner_radius=3, flex='wh') tbl.row_height=fontsize*2.5 tbl.name = 'Item Table' tbl.separator_color = 'grey' tbl.data_source = MyTableViewDataSource() tbl.delegate = MyTableViewDelegate() view.add_subview(tbl) view.present('sheet', title_bar_color= 'slateblue')
-
RE: Thoughts on Pythonista subreddit?
Love Pythonista And Love Reddit.
I think the biggest advantage in moving to Reddit would be getting a more intelligent search, searching in this forum is not good.
I am no expert but i see no downside to shifting to Reddit.