I'm making a management system with a function to view the database. I want to make it where a new window will pop up displaying the database when the user clicks the "view list" button. I'm saving the "list" function as a new .py file and i'm calling it using the code below in the main file
def listCustomer():
call(["python", "list.py"])
However, I can't seem to make the data appear on the new window as everytime the new window appears its an empty window. Can anyone tell me what I did wrong? I'll attach my code for the list.py file below
from tkinter import *
from PIL import ImageTk,Image
import sqlite3
root = Tk()
def list():
#Create database
connect = sqlite3.connect("hmsdata.db")
#Create cursor
c = connect.cursor()
#List database
c.execute("SELECT *, oid FROM details")
data = c.fetchall()
showData=''
for data in details:
showData += str(data)+"\n"
dataLabel = Label(root, text=showData)
dataLabel.grid(row=0, column=0)
#Commit changes
connect.commit()
#Close connection
connect.close()
This is what happens when I click the "View Customer" Button, it does not display anything
