1234567891011121314151617 |
- def openStudentListFile(self):
- tf = filedialog.askopenfilename(
- initialdir=os.getcwd() + os.path.join("\\studentlists"),
- title="Choose Student List file",
- filetypes=(("Text Files", "*.txt"),)
- )
- if tf == "":
- self.studentListVar.set("")
- self.chooseStudentsLabel['text'] = ""
- return
- tf = open(tf) # or tf = open(tf, 'r')
- self.studentListVar.set(tf.name)
- self.chooseStudentsLabel['text'] = tf.name[tf.name.rfind("/") + 1:len(tf.name)]
- tf.close()
|