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.
Help with Menu/window for Pythonista..
-
@Phuket2 @mtrevino57 They may also have added a lot of functionality since I use it last. I think I remember that most features were a paid upgrade when I got it last? I didn't really think it was worth the money, and it didn't seem to do anything Pythonista couldn't with matplotlib
-
@Webmaster4o , for me it's a different idea. You can write some interesting data somewhere (maybe need some html formatting code), and many clients (status board clients) can read the data. Can also send to Apple TV. So in Pythonista sill massaging data and writing it out. Granted you can do on a Mac/pc also. But I think it's a nice solution when you just want to concentrate on the data, not the ui and the distribution of data.
-
Plan B, Looking at StatusBoard I am thinking it would be better to to merge the gauges into a single image which could then be posted to Twitter. I am thinking I would need to use Canvas but if there is a simple way, I am all ears. The final image would look something like the following
-
@mtrevino57 Check out PIL for this. It's really useful. The images you're using now could be easily put on a blank PIL.Image and saved.
-
Perfect! Simple is best THANKS!!
-
Okay using PIL, have the following in Pythonista on the Iphone, and it works great to display projects one at a time.
i=0 # set ii,jj for creating 4x3 gridded image with all projects ii=0 jj=0 # create a grid to hold project status images grid_image = Image.new('RGB', (942,792),'white') thumbnailsize = 314,264 #print Image.getbbox(grid_image) print "\f\a" .... ....code for generating charts was here .... #--------------------------------------- ## setup for gauge plot fig, ax = plt.subplots() # ax = plt.subplots() ax.axis('equal') # Width of the "rings" (percentages if the largest "radius"==1) width = 0.2 kwargs = dict(colors=['#FFFFFF', '#FFFFFF', '#0077be',"#FFffFF"], startangle=0) kwargs_outer = dict(colors=['#FF0000', '#FFFF00', '#0000FF',"#FFffFF"], startangle=0) # outside, _ = ax.pie([spspc,fpspc,cpspc,totspc], radius=1, **kwargs_outer) inside, _ = ax.pie([totspc-resspc,0,resspc,totspc], radius=1-width, **kwargs) # Set the edgecolor to match background to hide "Pie Chart" plt.setp(outside,edgecolor='white') plt.setp(inside,edgecolor='white') # set size of plot - this size works best on Iphone 5 Screen... fig.set_size_inches(4.75,4) labeltext= globals()[stcode[i]].Name +" on "+cdate+"\nStorage: "+str("%.2f" % float(storelev2[0]))+" AF\nElev: "+str(elevnow)+" ft @"+lasttime+"\nis "+str("%.2f" % cspace)+" ft below top of\n"+str(cpool[2])+": "+str(cpool[1])+" ft" # check which pool is active to set colors for bounding box. if cpool[2]=='CONSERVATION Pool': kwargs1 = dict(size=20,color='white',va='center',ha='center') ax.text(0,-.75,labeltext,bbox=dict(facecolor='blue',edgecolor='none'),fontsize=20,**kwargs1) elif cpool[2] == 'FLOOD Pool': kwargs1 = dict(size=20,color='black',va='center',ha='center') ax.text(0,-.75,labeltext,bbox=dict(facecolor='yellow',edgecolor='none'),fontsize=20,**kwargs1) elif cpool[2] == 'SURCHARGE Pool': kwargs1 = dict(size=20,color='white',va='center',ha='center') ax.text(0,-.75,labeltext,bbox=dict(facecolor='red',edgecolor='none'),fontsize=20,**kwargs1) else: ax.text(0,-.75,labeltext,fontsize=20) #display gauge with text plt.show() #--------------------------------------- # add plt to grid g_img=fig grid_image.paste(g_img, (ii,jj)) ii+=314 if ii==942: ii=0 jj+=264 #--------------------------------------- i+=1 grid_image.show()
I must be missing something, BUT if I understand this, the actual plot is stored in fig, and the size of each gauge is 314 x 264 based on saving images on iphone and looking at properties, so for a 4x3 grid the new image would be 942x792. When I run the program, I get the ValueError: cannot determine region size; use 4-item box error. I have seen plenty of examples for opening an existing image file and pasting that to a second image, but apparently I am missing something with trying to save the gauge "fig" which is displayed using plt.show(). Suggestions?
-
@mtrevino57 Off-topic: When you paste code here, it should be surrounded by triple back-ticks or tildes (optionally followed by
python
) to be formatted correctly. Example:```python # code here... ```
I've already edited your previous post.
-
Any chance there is a file with Posting guidelines/tips somewhere that I missed?
-
@mtrevino57 Not really. Posts are formatted in Markdown, like on many other developer-centric sites (StackOverflow, GitHub...). There's a good cheatsheet here: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
-
I think you miss a column!? 1256x792
-
@brumm, Thanks!!!
You are Correct, as far as the size of the final image, it would be 1256. When pasting I would start a 0,314,628,942 for the x-axis and the four across should work. I am still getting the cannot determine the region size. HOWEVER!!! I am getting closer, now am able to save the plots to files, so eventually I should be able to create a gridded image and paste the files back into it. Seems a bit redundant since all I really want to do is paste the current figure/plot into a 4x3 grid. Getting the math correct on figure size, I am left with the ValueError: cannot determine region size; use 4-item box. -
GOT IT! The ValueError was related to how I was loading the image. And I once I got the columns and size right(Thanks brumm), it works.
-
@mtrevino57 You're welcome 😉
-
YES! Thanks to EVERYONE who took a look at this, MORE EYES is better than TWO! ;-)
-
-
@mtrevino57 Triple quoted strings combined str.format() can make your code easier to understand and faster to execute than repeated calls to str() combined with string concatenation...
fmt = '''{} on {} Storage: {:.2f} AF Elev: {} ft @{} is {:.2f} ft below top of {}: {} ft''' print(fmt.format('Altus', '16FEB19', 109068, 1555.555, '13:00', 3.45, 'CONSERVATION Pool', 1559)) labeltext = fmt.format(globals()[stcode[i]].Name, cdate, float(storelev2[0]), elevnow, lasttime, cspace, cpool[2], cpool[1])
-
This post is deleted! -
@ccc GOT IT! THANKS Again!!!!