0

I have a tkinter page that works by calling other tkinter pages, each with their own functions. When I call the page locally, the function works, but when it is called from the other page it doesn't work. The function used to call the other page is this.

from tkinter import *
import subprocess
import tkinter.messagebox
import os.path

class meh:
    def __init__ (self,root):
        self.root =root
        self.root.title("ODIN")
        self.root.geometry("1350x750+0+0")
        self.root.config(bg="ghost white")

        def ap():
            subprocess.call(["python.exe",r"C:\Users\felix\Documents\FelixPython\AttendancePageAdmin.py"])
            #AttendancePage.Attendance(Tk())

        MainFrame = Frame(self.root, bg="Ghost White")
        MainFrame.grid()

        CallButtonFrame = Frame(MainFrame, bd=2, width=1350, height=70, padx=18, pady=10, bg="blue2", relief = RIDGE)
        CallButtonFrame.pack(side=TOP)


        self.btnAttend = Button(CallButtonFrame, text = 'Attendance page' , font=('ariel',20,'bold'),height=1,width=10, bd=4, command = ap)
        self.btnAttend.grid(row=0, column=0)

if __name__=='__main__':
    root = Tk()
    application = meh(root)
    root.mainloop()

FPBL
  • 3
  • 3
  • Can you provide the error message you get? My guess is that `AttendancePageAdmin.py` uses modules that are not in your `PYTHONPATH` – Jean-Marc Volle May 14 '20 at 11:42
  • _”Doesn’t work”_ is too vague. What do you mean? Does it throw an error? Do the wrong thing? Something else? – Bryan Oakley May 14 '20 at 12:46
  • The program AttendancePageAdmin is designed to access an SQL database, when I press the button in the windo it gives the error "sqlite3.OperationalError: no such table: Attendance" – FPBL May 14 '20 at 13:10
  • Read [Why are multiple instances of Tk discouraged?](https://stackoverflow.com/a/48045508/7414759). Does this answer your question? [how-would-i-access-variables-from-one-class-to-another](https://stackoverflow.com/questions/19993795) – stovfl May 14 '20 at 14:12

0 Answers0