Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import time
- import connection
- # Создание окна и ее параметров
- window = Tk()
- window.geometry("400x400")
- window.title("Planner")
- label = Label(text="Lost? ")
- label.grid(row=5, column=5)
- # Объявление кнопки "Submit"
- def Submit():
- session = connection.create_connection(
- "dolist", "postgres", "gAbenloh3221", "localhost", "5432"
- )
- # Создание курсора
- cursor = session.cursor()
- # Insert в таблицу
- cursor.execute("INSERT INTO do_list(name, time) VALUES('Name', 'Time')",
- {
- 'Task': Name,
- 'Time': Time
- })
- taskName.delete(0, END)
- taskTime.delete(0, END)
- # Объявление кнопки "Yes"
- def Ycon():
- label["text"] = "Let's see..."
- global taskName
- taskName= Entry(window, width=30)
- global taskTime
- taskTime= Entry(window, width=30)
- # Расстановка текстовых полей
- taskName.grid(row=3, column=3)
- global Name
- Name = taskName.get()
- taskTime.grid(row=4, column=3)
- global Time
- Time = taskTime.get()
- Time = int(Time)
- # Объявление кнопки "No"
- def Ncon():
- time.sleep(1)
- window.quit()
- # Отображение кнопоки "Yes"
- YesCon = Button(master=window, text="Yes", command=Ycon, width=5)
- YesCon.grid(row=1, column=0, sticky="nsew")
- # Отображение кнопоки "No"
- NoCon = Button(master=window, text="No", command=Ncon, width=5)
- NoCon.grid(row=1, column=1, sticky="nsew")
- # Расстановка кнопок
- submitButton = Button(window, text="Let's see what we can do... ", command=Submit)
- submitButton.grid(row=5, column=3)
- window.mainloop()
Add Comment
Please, Sign In to add comment