Diskuze: tkinter tlačítko zpět
Zobrazeno 2 zpráv z 2.
Zde je ukázka kodu:
# funkce spustí Import dat - 1. okno
def new():
#zavře předchozí okno
root.withdraw()
#globální proměnné
global c_pos
global specs
global obv
global main
#nové okno Import 1/X
main = Toplevel()
main.title('Import dat 1/X')
main.geometry('400x210')
main.resizable(0,0)
main.iconbitmap('e:\\--- DRIVE\\Python\\Projects\\2019\\05\\icons\\MainIcon.ico')
# oddělovací linka
separator = Frame(main, height=2, bd=1, relief=SUNKEN)
separator.grid(row=1, column=0, columnspan=3, sticky='ew')
nadpis_label = Label(main, text='Zadej informace:', height=2, bg='#e4e4e4', anchor=W, padx=10, pady=7)
nadpis_label.grid(row=2, column=0, columnspan=3, ipadx=100)
# oddělovací linka
separator = Frame(main, height=2, bd=1, relief=SUNKEN)
separator.grid(row=3, column=0, columnspan=3, sticky='ew')
# vpisovací pole
c_pos = Entry(main, width=30)
c_pos.grid(row=4, column=1, pady=(15,3))
specs = Entry(main, width=30)
specs.grid(row=5, column=1, pady=3)
band = Entry(main, width=30)
band.grid(row=6, column=1, pady=3)
# popisky
c_pos_label = Label(main, text='Číslo pos:')
c_pos_label.grid(row=4, column=0, sticky='w', padx=(40,0), pady=(15,3))
specs_label = Label(main, text='Specifikace:')
specs_label.grid(row=5, column=0, sticky='w', padx=(40,0), pady=3)
band_label = Label(main, text='Bandita:')
band_label.grid(row=6, column=0, sticky='w', padx=(40,0), pady=3)
# tlačítka Zpět a Další
submitButton = Button(main, text='Další', width=10, command=submit1)
submitButton.grid(row=7, column=1, columnspan=3, padx=(130,60), pady=(20,0))
backButton = Button(main, text='Zpět', width=10, command=back1)
backButton.grid(row=7, column=0, columnspan=3, padx=5, pady=(20,0))
def back1():
#zavře předchozí okno
main.withdraw()
# Main window
root = Tk()
root.title('Generátor v 1.0')
root.geometry('400x400')
root.resizable(0,0)
root.iconbitmap('e:\\--- DRIVE\\Python\\Projects\\2019\\05\\icons\\MainIcon.ico')
# Copyright button
button = Button(root, text='i', width=3, height=1, command=ShowInfo)
button.grid(row=1, column=2, columnspan=10)
# Hlavní menu
button = Button(root, text='Nový', width=15, height=2, command=new)
button.grid(row=3, column=1, pady=(55,0), padx=(150, 100))
button = Button(root, text='Načíst z databáze', width= 15, height=2)
button.grid(row=4,column=1, pady=(20,0), padx=(150, 100))
button = Button(root, text='Zobrazit databázi', width=15, height=2)
button.grid(row=5, column=1, pady=(20,0), padx=(150, 100))
button = Button(root, text='Ukončit', width=15, height=2, command=root.quit)
button.grid(row=6, column=1, pady=(20,0), padx=(150, 100))
# Copyright button
button = Button(root, text='i', width=3, height=1, command=ShowInfo)
button.grid(row=1, column=2, columnspan=10)
# Hlavní menu
button = Button(root, text='Nový ', width=15, height=2, command=new)
button.grid(row=3, column=1, pady=(55,0), padx=(150, 100))
button = Button(root, text='Načíst z databáze', width= 15, height=2)
button.grid(row=4,column=1, pady=(20,0), padx=(150, 100))
button = Button(root, text='Zobrazit databázi', width=15, height=2)
button.grid(row=5, column=1, pady=(20,0), padx=(150, 100))
button = Button(root, text='Ukončit', width=15, height=2, command=root.quit)
button.grid(row=6, column=1, pady=(20,0), padx=(150, 100))
root.mainloop()
Zobrazeno 2 zpráv z 2.