OpenFiles_4.py 454 B

1234567891011121314151617
  1. def uploadZipFile(self):
  2. tf = filedialog.askopenfilename(
  3. initialdir=str(Path.home() / "Downloads"),
  4. title="Choose Zip file",
  5. filetypes=(("Zip Files", "*.zip"),)
  6. )
  7. if tf == "":
  8. self.zipVar.set("")
  9. self.zipLabel['text'] = ""
  10. return
  11. tf = open(tf) # or tf = open(tf, 'r')
  12. self.zipVar.set(tf.name)
  13. self.zipLabel['text'] = tf.name[tf.name.rfind("/") + 1:len(tf.name)]
  14. tf.close()