Wednesday, September 26, 2018

Tkinter Text Widgets in Python

- I have been working hard on my Refcards-System idea, in Python;
- I want it to be a simple database with simple interface where you can add records to a given table and then view your "notes" or "Refcards";
- The idea is to have a GUI to flip through Refcards in the database;


import sqlite3
import os
from Tkinter import *
root = Tk()
S = Scrollbar(root)
T = Text(root, height=8, width=75)
S.pack(side=RIGHT, fill=Y)
T.pack(side=LEFT, fill=Y)
S.config(command=T.yview)
T.config(yscrollcommand=S.set)
os.chdir('C:\\FILEPATH')
conn = sqlite3.connect("refcards2019.db")
cursor = conn.cursor()
sql = "SELECT * FROM refcards"
cursor.execute(sql)
# note = cursor.fetchone()[2]
note = cursor.fetchall()[1][2]
T.insert(END, note)
mainloop( )
conn.close()



No comments:

Post a Comment