Friday, February 13, 2015
I am writing a series http://biorpy.blogspot.com/. R is a programming language for statistical programming. It is very similar to Python in that it is a scripting language. I contrast it with Python data analysis with modules like numpy and pandas. I am learning R, and since I know Python, I keep on trying to compare. It is best to use Anaconda or some other scientific distribution with most of the modules included. If a module is needed that is not included in Anaconda or from the conda command line utility, it can be easily added using pip program, again from the command line. You have to use the pip program inside Anaconda. For R, after installing the base program, add RStudio and you can add more packages from inside RStudio console.
Wednesday, August 13, 2014
TabbedPanels provide tabs to select between different screens.
The TabbedPanel widget is used for the root. The App class is needed for any application.
We have to have a subclass of the App class.
# ex58.py from kivy.uix.tabbedpanel import TabbedPanel from kivy.app import App class Ex58(TabbedPanel): pass class Ex58App(App): def build(self): return Ex58() if __name__ == '__main__': Ex58App().run()
In the kv file, the MyImage dynamic class is created and it allows for a stretchable image.
The first 2 screens are of the images p1 and p2. There will only be tabs for the Panels and their width is 199 pixels.
The next 3 screens corresponds to images p3, p4 and p5.
# ex58.kv <MyImage@Image>: keep_ratio: False allow_stretch: True <Ex58>: do_default_tab: False tab_width: 199 TabbedPanelItem: text: 'The Basin' MyImage: source: 'p1.png' TabbedPanelItem: text: 'Boise Rock' MyImage: source: 'p2.png' TabbedPanelItem: text: 'Old Forest' MyImage: source: 'p3.png' TabbedPanelItem: text: 'Old Man of the Mountain' MyImage: source: 'p4.png' TabbedPanelItem: text: 'Flume Gorge' MyImage: source: 'p5.png'
In this result, we select the p1 image. The window was resized to show all tabs. For the mobile, you will have to make calculations about the tab size so they all fit in a fixed-size screen.