Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- import kivy
- kivy.require("1.10.0")
- from kivy.app import App
- from kivy.uix.boxlayout import BoxLayout
- import psycopg2
- class TestDB(BoxLayout):
- def export_data(self):
- connection_str = "dbname = postgres user = postgres host = localhost password=psswd"
- conn = psycopg2.connect(connection_str)
- cur = conn.cursor()
- cur.execute("INSERT INTO uniaxdb (patient_id,specimen_id) VALUES(
- 'test1','test2')")
- cur.close()
- class TestDBApp(App):
- def build(self):
- return TestDB()
- if __name__ == '__main__':
- TestDBApp().run()
- <TestDB>:
- orientation: 'vertical'
- BoxLayout:
- Button:
- text: "export to DB"
- on_release: root.export_data()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement