import sqlite3
my_conn = sqlite3.connect('my_db.db')
from sqlalchemy import create_engine
#my_conn=create_engine("sqlite:////content/drive/MyDrive/db/my_db.db")
my_conn = create_engine("sqlite:///D:\\testing\\my_db\\my_db.db")
In windows system, the absolute path is used in above code.Display | Paging : Breaking of number of records to pages |
Delete | Delete record on button click and after user confirmation |
record display | Return details of the record by entering row ID |
record add | Insert user entered data through Tkinter window to SQLite table |
OptionMenu | Unique data from SQLite as OptionMenu list |
Two OptionMenus | Two dependant OptionMenus ( Category and subcategory) |
Blob Column | Managing Blob column, changes required in Script managing MySQL database |
SQLite Connector | Application to Manage Database and create new database |
Data Entry | GUI to enter data to SQLite and display the same in Treeview |
r_set=my_conn.execute('''SELECT * from student LIMIT 0,10''');
i=0 # row value inside the loop
for student in r_set:
for j in range(len(student)):
e = Entry(my_w, width=10, fg='blue')
e.grid(row=i, column=j)
e.insert(END, student[j])
i=i+1
This will print 10 rows of records from student table.
import sqlite3
my_conn = sqlite3.connect('my_db.db')
###### end of connection ####
##### tkinter window ######
import tkinter as tk
from tkinter import *
my_w = tk.Tk()
my_w.geometry("400x250")
r_set=my_conn.execute('''SELECT * from student LIMIT 0,10''');
i=0 # row value inside the loop
for student in r_set:
for j in range(len(student)):
e = Entry(my_w, width=10, fg='blue')
e.grid(row=i, column=j)
e.insert(END, student[j])
i=i+1
my_w.mainloop()
import tkinter as tk
from tkinter import *
from sqlalchemy import create_engine
my_w = tk.Tk()
my_w.geometry("400x250")
my_conn = create_engine("sqlite:///D:\\testing\\my_db\\my_db.db")
r_set=my_conn.execute('''SELECT * from student LIMIT 0,10''')
i=0 # row value inside the loop
for student in r_set:
for j in range(len(student)):
e = Entry(my_w, width=10, fg='blue')
e.grid(row=i, column=j)
e.insert(END, student[j])
i=i+1
my_w.mainloop()
from sqlalchemy import create_engine
from sqlalchemy.exc import SQLAlchemyError
my_path="D:\\testing\\sqlite\\my_db.db" #Change the path
my_conn = create_engine("sqlite:///" + my_path)
import tkinter as tk
from tkinter import *
my_w = tk.Tk()
my_w.geometry("400x250")
r_set=my_conn.execute('SELECT * from student LIMIT 0,10')
i=0 # row value inside the loop
for student in r_set:
for j in range(len(student)):
e = tk.Label(my_w, width=10, fg='blue',text=student[j],anchor='w')
e.grid(row=i, column=j,padx=2)
i=i+1
my_w.mainloop()
16-03-2021 | |
Can you change the location of the table in the window |
23-03-2021 | |
yes by adding starting value to i ( now it starts from 0 ) any other value , i =2. But fill with some value of row=1. Similarly you can change the value of j to 2 or 3 and fill the value of column 0 and column 1. |
16-04-2021 | |
I don't know if im doing something wrong but this does not work for me. |
17-04-2021 | |
What is the error you are getting ? Break this to different steps , first display the data and then add Tkinter and check where the problem is |
20-04-2021 | |
I have no errors, just when I change the value of J and I it does not alter the position of the table. |