Code Monkey home page Code Monkey logo

rvapi's Introduction

Examples

Creating a document

>>> from rvapi import NewDocument
>>> main = NewDocument("GUI", "jsrview", "Main")

Create a tab

>>> from rvapi import Tab
>>> tab = Tab(main, "Summary Tab", opened=True)
>>> tab.add_text("hello World")

Create a section

>>> from rvapi import Section
>>> section = Section(tab, "Summary Section", opened=True)
>>> section.add_text("Hello World")

Create a table in the tab

>>> from rvapi import Table
>>> table = Table(tab, "Summary Table")
>>> table.add_col_header("one,two,three".split(","))
>>> table.add_row("1,2,3".split(","))
>>> table.add_row("3,4,5".split(","))

Create a section with a tab

>>> section2 = Section(tab, "Summary Section 2", opened=True)
>>> table2 = Table(section2, "Summary Table 2")
>>> table2.add_col_header("one,two,three".split(","))
>>> table2.add_row("1,2,3".split(","))
>>> table2.add_row("3,4,5".split(","))
Add something to the previous table with time delay
>>> import time
>>> time.sleep(5)
>>> table.add_row("10,11,12".split(","))

Add some data to the section

>>> from rvapi import Data
>>> data = Data(section2, "Example File")
>>> data.add_data("foobar.txt", "text")
Another example of a PDB file
>>> data2 = Data(tab, "Some Structure", opened=True)
>>> data2.add_data("structure.pdb", "xyz")

Add a tree

>>> from rvapi import Tree
>>> tree = Tree(section2, "Tree Example", opened=True)
>>> Section(tree, "Section 1").set_tree_node()
>>> tree_section2 = Section(tree, "Section 2")
>>> tree_section2.set_tree_node()
>>> tree_section2a = Section(tree, "Section 2a")
>>> tree_section2a.set_tree_node(parent_node=tree_section2)
>>> tree_section2b = Section(tree, "Section 2b")
>>> tree_section2b.set_tree_node(parent_node=tree_section2)
Add some text to the tree sections
>>> for i, section in enumerate(tree):
...     section.add_text("Hello World {}".format(i))

Adding a radar figure

>>> from rvapi import Radar
>>> tab2 = Tab(main, "Figure Tab")
>>> radar = Radar(tab2, "What's the best?", opened=True)
>>> radar.add_property("Option 1", 0.1)
>>> radar.add_property("Option 2", 0.2)
>>> radar.add_property("Option 3", 1.0)

Adding a plot figure

>>> from rvapi import Graph, GraphData, GraphDataset
>>> graph = Graph(tab2)
>>> graph_data = GraphData(graph, "Trigonometry")
>>> dataset1 = GraphDataset(graph_data, "x", "argument")
>>> dataset2 = GraphDataset(graph_data, "sin(x)", "Sine")
>>> dataset3 = GraphDataset(graph_data, "cos(x)", "Cosine")
Add some data to the plot
>>> from math import sin, cos
>>> for i in range(1, 21):
...     dataset1.add_int(i)
...     dataset2.add_real(sin(i*6.28/19.0))
...     dataset3.add_real(cos(i*6.28/19.0))

rvapi's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

clacri

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.