Advertisement
Guest User

python

a guest
Feb 17th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. from tkinter import *
  2. tk=Tk()
  3. tk.geometry("1000x400")
  4. def Button_click():
  5.      global image
  6.      if var.get()==1:
  7.                      image=PhotoImage(file='flowers.png')
  8.      if var.get()==2:
  9.                      image=PhotoImage(file='cake.png')
  10.      if var.get()==3:
  11.                      image=PhotoImage(file='landscape.png')
  12.      select=lb.curselection()
  13.      lbl3=Label(text=lb.get(select)+","+ent.get()+"!")
  14.      lbl3.place(x=350, y=300)
  15.      canvas.create_image(500,200, image=image)
  16. def Button2_click():                
  17.      lbl2=Label(text="Бувай, " +ent.get())
  18.      lbl2.place(x=350, y=300)
  19. canvas=Canvas(tk, width=600, height=400)
  20. canvas.pack()
  21. image=PhotoImage(file="flowers.png")
  22. btn1=Button(text="Привітання", command=Button_click)
  23. btn1.place(x=500,y=200,width=100,height=50)
  24. btn2=Button(text="Прощавання", command=Button2_click)
  25. btn2.place(x=350,y=200,width=100,height=50)
  26. ent=Entry()
  27. ent.place(x=450,y=100,width=100,height=30)
  28. lbl1=Label(text="Ваше ім'я")
  29. lbl1.place(x=200,y=100)
  30. lb=Listbox(height=3)
  31. lb.insert(END,"З 8 березня")
  32. lb.insert(END,"З Новим Роком")
  33. lb.insert(END,"З Днем народження")
  34. lb.place(x=375,y=25)
  35. var=IntVar()
  36. rb1=Radiobutton(text="цветочки", variable=var, value=1)
  37. rb2=Radiobutton(text="торт", variable=var, value=2)
  38. rb3=Radiobutton(text="пейзаж", variable=var, value=3)
  39. rb1.place(x=600,y=250)
  40. rb2.place(x=600,y=300)
  41. rb3.place(x=600,y=350)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement