1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
def br2Box(self):
self.mv = Toplevel()
self.mv.title('Export mavlink .tlog')
self.mv.transient() # Réduction popup impossible
self.mv.grab_set() # Interaction avec fenetre jeu impossible
self.mv.focus() # Focus sur la fenetre popup
file_input = tk.Frame(self.mv, bg='green')
footer = tk.Frame(self.mv)
self.mv.columnconfigure(0, weight=1) # 100%
self.mv.rowconfigure(0, weight=1) # 10%
self.mv.rowconfigure(1, weight=1) # 80%
file_input.grid(row=0, sticky='news')
footer.grid(row=1)
self.mv.input_path = StringVar()
self.mv.lbl_fin0 = tk.Label(file_input, text="Fichier .tlog")
self.mv.lbl_fin0.grid(row=0, column=0, padx=5, pady=5)
self.mv.lbl_fin = tk.Label(file_input, width=30, textvariable=self.mv.input_path)
self.mv.lbl_fin.grid(row=0, column=1, padx=5, pady=5)
self.mv.btn_fin = Button(file_input, text='...', width=5, command=self.fileSelect)
self.mv.btn_fin.grid(row=0, column=2, padx=5, pady=5)
self.mv.btn_OK = Button(footer, text='OK', width = 10, command=self.mv.destroy)
self.mv.btn_OK.grid(column=0, row=0, padx=5, pady=5)
self.mv.btn_Cancel = Button(footer, text='Annuler', width = 10, command=self.mv.destroy)
self.mv.btn_Cancel.grid(column=1, row=0, padx=5, pady=5)
def fileSelect(self):
f = askopenfilename(title="Ouvrir votre document", \
filetypes=[('logfile','.tlog'), ('all files','.*')], \
initialdir=os.path.dirname(os.path.abspath(__file__)))
print(f)
self.mv.input_path.set(f)
self.mv.lbl_fin.update_idletasks() |
Partager