ChiSteward/MainTkinter.py

41 lines
920 B
Python

from tkinter import *
from firstpage import *
from MainWin import *
from config import CONFIG
from Ncnu import *
from Moodle import *
from NcnuMainWin import *
from api.moodle import MoodleAPI
from api.ncnu import NcnuAPI
import threading
moodle = None
ncnu = None
win=Tk()
firstWin(win)
def checkJson():
def login():
global moodle, ncnu
moodle = MoodleAPI(CONFIG['moodle']['username'], CONFIG['moodle']['password'])
ncnu = NcnuAPI(CONFIG['NCNU']['username'], CONFIG['NCNU']['password'])
tempWin.destroy()
tempWin = Tk()
Label(tempWin, text="登入中...", font="50").pack()
t = threading.Thread(target=login)
t.start()
tempWin.mainloop()
if moodle.status and ncnu.status:
mainWin=Tk()
createMainWin(mainWin,ncnu,moodle)
else:
mainWin=Tk()
loginwin(mainWin)
win.protocol("WM_DELETE_WINDOW",checkJson())