Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.38 KB | None | 0 0
  1. import tkinter as tk
  2.  
  3. output_list = []
  4. questions = []
  5.  
  6.  
  7. # клик2
  8. def clicked():
  9.     if selected.get() == 0 or selected1.get() == 0 or selected2.get() == 0 or selected3.get() == 0 or selected4.get() == 0: return
  10.     questions.append(selected.get())
  11.     questions.append(selected1.get())
  12.     questions.append(selected2.get())
  13.     questions.append(selected3.get())
  14.     questions.append(selected4.get())
  15.  
  16.  
  17. # клик1
  18. def click_1():
  19.     if txt.get() == '' or txt2.get() == '': return
  20.     output_list.append(txt.get())
  21.     output_list.append(txt2.get())
  22.     window.title(output_list[0] + ' ' + output_list[1])
  23.     lbl.destroy();
  24.     lbl1.destroy()
  25.     txt.destroy();
  26.     txt2.destroy()
  27.     btn.destroy()
  28.  
  29.  
  30. # окошко
  31. window = tk.Tk()
  32. window.geometry('680x650')
  33. window.title("")
  34.  
  35. # фио
  36. lbl = tk.Label(window, text="Введите имя: ", font=("Arial Bold", 10))
  37. lbl1 = tk.Label(window, text="введите фамилию: ", font=("Arial Bold", 10))
  38.  
  39. # размещение текста
  40. lbl.grid(column=0, row=0, sticky='w')
  41. lbl1.grid(column=0, row=1, sticky='w')
  42.  
  43. # тоже текст
  44. txt = tk.Entry(window, width=10)
  45. txt2 = tk.Entry(window, width=10)
  46. txt.grid(column=2, row=0, sticky='w')
  47. txt2.grid(column=2, row=1, sticky='w')
  48.  
  49. # кнопочка
  50. btn = tk.Button(window, text="подтвердить", bg="maroon2", command=click_1, width=20, pady=10)
  51. btn.grid(column=160, row=1)
  52.  
  53. # галочки в тестах
  54. selected = tk.IntVar()
  55. selected1 = tk.IntVar()
  56. selected2 = tk.IntVar()
  57. selected3 = tk.IntVar()
  58. selected4 = tk.IntVar()
  59. selected5 = tk.IntVar()
  60. selected6 = tk.IntVar()
  61. selected7 = tk.IntVar()
  62. selected8 = tk.IntVar()
  63. selected9 = tk.IntVar()
  64. selected10 = tk.IntVar()
  65. selected11 = tk.IntVar()
  66. selected12 = tk.IntVar()
  67. selected13 = tk.IntVar()
  68. selected14 = tk.IntVar()
  69.  
  70. # сами тесты
  71. lbl3 = tk.Label(window, text="Я подавлена, мне тоскливо: ", font=("Arial Bold", 10))
  72. rad1 = tk.Radiobutton(window, text='Да', value=1, variable=selected)
  73. rad2 = tk.Radiobutton(window, text='Нет', value=2, variable=selected)
  74. rad3 = tk.Radiobutton(window, text='Затрудняюсь ответить', value=3, variable=selected)
  75.  
  76. lbl4 = tk.Label(window, text="Лучше всего чувствую себя утром: ", font=("Arial Bold", 10))
  77. rad4 = tk.Radiobutton(window, text='Да', value=1, variable=selected1)
  78. rad5 = tk.Radiobutton(window, text='Нет', value=2, variable=selected1)
  79. rad6 = tk.Radiobutton(window, text='Затрудняюсь ответить', value=3, variable=selected1)
  80.  
  81. lbl5 = tk.Label(window, text="Хочется плакать?: ", font=("Arial Bold", 10))
  82. rad7 = tk.Radiobutton(window, text='Да', value=1, variable=selected2)
  83. rad8 = tk.Radiobutton(window, text='Нет', value=2, variable=selected2)
  84. rad9 = tk.Radiobutton(window, text='Затрудняюсь ответить', value=3, variable=selected2)
  85.  
  86. lbl6 = tk.Label(window, text="Всю ночь не могу уснуть: ", font=("Arial Bold", 10))
  87. rad10 = tk.Radiobutton(window, text='Да', value=1, variable=selected3)
  88. rad11 = tk.Radiobutton(window, text='Нет', value=2, variable=selected3)
  89. rad12 = tk.Radiobutton(window, text='Затрудняюсь ответить', value=3, variable=selected3)
  90.  
  91. lbl7 = tk.Label(window, text="Ем как обычно: ", font=("Arial Bold", 10))
  92. rad13 = tk.Radiobutton(window, text='Да', value=1, variable=selected4)
  93. rad14 = tk.Radiobutton(window, text='Нет', value=2, variable=selected4)
  94. rad15 = tk.Radiobutton(window, text='Затрудняюсь ответить', value=3, variable=selected4)
  95.  
  96. lbl8 = tk.Label(window, text="Смотрю в будущее с надеждой: ", font=("Arial Bold", 10))
  97. rad16 = tk.Radiobutton(window, text='Да', value=1, variable=selected5)
  98. rad17 = tk.Radiobutton(window, text='Нет', value=2, variable=selected5)
  99. rad18 = tk.Radiobutton(window, text='Затрудняюсь ответить', value=3, variable=selected5)
  100.  
  101. lbl9 = tk.Label(window, text="Мне доставляет удовольствие общество привлекательных людей: ", font=("Arial Bold", 10))
  102. rad19 = tk.Radiobutton(window, text='Да', value=1, variable=selected6)
  103. rad20 = tk.Radiobutton(window, text='Нет', value=2, variable=selected6)
  104. rad21 = tk.Radiobutton(window, text='Затрудняюсь ответить', value=3, variable=selected6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement