-
ramvee
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 -
ramvee
I Am Using Pythonista On My iPad Pro And I Have No Issues At All, It Works Fine.
-
ramvee
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. -
ramvee
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')
-
ramvee
Thank You Very Much For The Prompt Reply @cvp !
I can figure it out now. :) -
ramvee
@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 :) -
ramvee
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')
-
ramvee
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. -
ramvee
HI @sulcud,
Mindnotes app, looks interesting,
could you please put up the english version,
when you are free.
Thank you -
-
-
ramvee
@Phuket2 ,
Thank you very much for the tip.
I would also like to thank you for your old post on the same topic at
https://forum.omz-software.com/topic/3401/share-using-draw_snapshot-method
which i saw after i posted this thread.
Sometimes searching is very difficult in this forum. :)
Take Care -
-
ramvee
HI,
I am sure this is a basic question..
i want the simplest way to save the puzzle generated on the console to be saved as an image.
I tried reading through ImageContext, Image, ctx etc but failed to understand.
Please help..For eg. let's say i want to save this display as an image..
# save display import ui w,h = ui.get_screen_size() view = ui.View(name = 'Grid', bg_color=1) view.add_subview(ui.View(name='left', frame=(0,0,w/3,h/5), bg_color='blue')) view.add_subview(ui.View(name='right', frame=(w*2/3,0,w/3,h/5), bg_color='red')) view.present('sheet')
-
ramvee
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. -
ramvee
Hi,
I often get "cannot import name 'pyplot' error"
when i try to import matplotlibAs a work around, I go to Examples folder and run any plotting example, then it works,
after which i can import matplotlib normally.The error states something about "frozen importlib._bootstrap"
How can i avoid this error, in pythonista 3Thank you.
# Histogram # Basic plot import numpy as np import matplotlib.pyplot as plt height = [3, 12, 5, 18, 45] bars = ('A', 'B', 'C', 'D', 'E') y_pos = np.arange(len(bars)) plt.bar(y_pos, height, color=(0.2, 0.4, 0.6, 0.6)) # Custom Axis title plt.xlabel('X Axis Title', fontweight='bold', color = 'red', fontsize='17', horizontalalignment='center') plt.show()```
-
ramvee
Hope this helps..
# sets date time picker # you can get details of different parameters from strftime.org import datetime, ui date_picker = ui.DatePicker(bg_color=1) date_picker.mode = ui.DATE_PICKER_MODE_DATE_AND_TIME date_picker.date = datetime.datetime.strptime('01/03/1958-07:00:PM', '%d/%m/%Y-%I:%M:%p') date_picker.present()
-
ramvee
Hi,
I wrote a small utility for this.. hope you find it useful.https://forum.omz-software.com/topic/4328/modules-of-pythonista-displayed-with-help
-