Ничего не выводит в окно. Ошибку не пишет
Код:
from tkinter import *
import docx
root = Tk()
doc0 = docx.Document('C:\City\Kyiv.docx')
doc1 = docx.Document('C:\City\Lviv.docx')
doc2 = docx.Document('C:\City\Dnipro.docx')
doc3 = docx.Document('C:\City\Odessa.docx')
doc4 = docx.Document('C:\City\Harkiv.docx')
def change():
if var == 0:
text1.insert(1.0, doc0)
elif var == 1:
text1.insert(1.0, doc1)
elif var == 2:
text1.insert(1.0, doc2)
elif var == 3:
text1.insert(1.0, doc3)
elif var == 4:
text1.insert(1.0, doc4)
root.geometry("1300x1150")
text1 = Text(width = 24, height = 10, wrap = WORD)
text1.grid(row = 0, column = 2, sticky = W)
var = IntVar()
var.set(0)
kyiv = Radiobutton(text = 'Київ', variable = var, value = 0, command = change)
kyiv.grid(row = 0, column = 0, sticky = W)
lviv = Radiobutton(text = 'Львів', variable = var, value = 1, command = change)
lviv.grid(row = 1, column = 0, sticky = W)
dnipro = Radiobutton(text = 'Дніпро', variable = var, value = 2, command = change)
dnipro.grid(row = 2, column = 0, sticky = W)
odesa = Radiobutton(text = 'Одесса', variable = var, value = 3, command = change)
odesa.grid(row = 3, column = 0, sticky = W)
harkiv = Radiobutton(text = 'Харків', variable = var, value = 4, command = change)
harkiv.grid(row = 4, column = 0, sticky = W)
root.mainloop()
-
Вопрос задан
-
34 просмотра