先畫在爬蟲

This commit is contained in:
molaboon 2021-07-03 15:44:17 +08:00
parent e605816d24
commit f7d53846a4

View File

@ -13,14 +13,10 @@ def getIdAndName(course):
return coursesId ,courseName
def createMoodleWin(moodle):
if moodle.status:
# ===== 取得課程ID與名稱 =====
c = moodle.getCourses("1092")
coursesId,coursesName=getIdAndName(c)
#for e in moodle.getUpcomingEvents()
win=Tk()
rightFrame=Frame(win,bg="red")
@ -35,6 +31,7 @@ def createMoodleWin(moodle):
leftFrame.pack(fill=BOTH,side=LEFT)
rightFrame.pack(fill=BOTH)
#=====Leftframe 1.button ->show UpComingEvent 2.choose courses=======
def showUpComingEvent(): #叫出未來事件
@ -47,7 +44,6 @@ def createMoodleWin(moodle):
upComingEventBtn=Button(leftFrame,text="未來事件",font="Helvetica 10",command= lambda:showUpComingEvent() )
coursesListBox=Listbox(leftFrame)
mylb=Label(leftFrame,text="我的課程",font="Helvetica 15")
coursesListBox.insert(END,*coursesName)
mylb.pack(fill=X)
coursesListBox.pack(fill=BOTH)
@ -67,9 +63,19 @@ def createMoodleWin(moodle):
Html+='''</ol>'''
htmlLb.set_html(Html)
coursesListBox.bind("<<ListboxSelect>>", itemSelected)
coursesName=[]
coursesListBox.insert(END,*coursesName)
win.update()
coursesId,coursesName=getIdAndName(moodle.getCourses("1092"))
coursesListBox.insert(END,*coursesName)
print(coursesName)
coursesListBox.bind("<<ListboxSelect>>", itemSelected)
win.mainloop()
else:
print("Moodle 登入失敗")