Last active
December 2, 2021 09:46
-
-
Save maxpushka/16bf227aecd88a3a874c1357df9a6d91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
def click(): | |
def add_holiday(): | |
ibox.insert(END, entry2.get()) | |
win1.destroy() | |
win1 = Toplevel() | |
win1.title('Введення нового свята') | |
label3 = Label(win1, text = 'Введiть нове свято') | |
label3.pack(padx = 3, pady = 3) | |
entry2 = Entry(win1) | |
entry2.pack(padx = 3, pady = 3) | |
button3 = Button(win1, text = 'Додати', command = add_holiday) | |
button3.pack(padx = 3, pady = 3) | |
def congrats(): | |
def thank_you(): | |
win2.destroy() | |
win2 = Toplevel() | |
win2.title('Вiтання!') | |
select = ibox.curselection() | |
lbl = Label(win2, text = entry1.get() + ', ' + ibox.get(select)) | |
lbl.pack(padx = 3, pady = 3) | |
btn = Button(win2, text = 'Дякую!', command = thank_you) | |
btn.pack(padx = 3, pady = 3) | |
root = Tk() | |
label1 = Label(root, text = 'Виберiть вiтання') | |
label1.grid(row = 0, column = 2, sticky = 'e') | |
label2 = Label(root, text = "Введiть iм'я") | |
label2.grid(row = 1, column = 0, sticky = 'e') | |
entry1 = Entry(root) | |
entry1.grid(row = 1, column = 1) | |
ibox = Listbox(root, height = 4) | |
ibox.insert(0, 'з днем народження!') | |
ibox.insert(1, 'з Новим роком!') | |
ibox.grid(row = 1, column = 2, padx = 3, pady = 3) | |
button1 = Button(root, text = 'Привiтання!', command = congrats) | |
button1.grid(row = 2, column = 1) | |
button2 = Button(root, text = 'Додати вiтання', command = click) | |
button2.grid(row = 2, column = 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment