Advertisement
deadmarshal

py app

Sep 4th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #! /usr/bin/env python3
  2. __author__ = 'deadmarshal'
  3. import sqlite3 as sqlite
  4. from tkinter import *
  5. from tkinter import ttk
  6.  
  7. ##db tbl name: Words
  8. ##db first field name: Esperanto
  9. ##db second field name: English
  10. #sqlite
  11. db = sqlite.connect(r'/home/deadmarshal/Desktop/test.db')
  12. cur = db.cursor()
  13. cur.execute('select * from Words')
  14. for row in cur:
  15.     print(row)
  16.  
  17. rows = cur.fetchall()
  18. display_rows = []
  19. for row in rows:
  20.     display_rows.append(str(row([0] + '' + str(row[1]))))
  21.    
  22. #GUI
  23. root = Tk()
  24. frame1 = ttk.LabelFrame(root)
  25. frame1.config(height=200, width=300, text= "Words")
  26. frame1.pack(side=LEFT, anchor='nw')
  27. frame1.config(padding = (3, 5))
  28.  
  29. entry = ttk.Entry(frame1, width=30)
  30. entry.grid(row=0, column=0)
  31.  
  32. list = Listbox(frame1, height=10)
  33. s = Scrollbar(frame1, orient=VERTICAL)
  34. list.configure(yscrollcommand=s.set)
  35. list.grid(row=1, column=0)
  36. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement