P
P
pnaple2282021-12-21 22:57:47
Python
pnaple228, 2021-12-21 22:57:47

How to remove an error when displaying in a window of type text from a text file docx?

Nothing pops up in the window. Does n't write
an error _ _ 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,




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 = 'Kiev', variable = var, value = 0, command = change)
kyiv.grid(row = 0, column = 0, sticky = W)

lviv = Radiobutton(text = 'Lviv', variable = var, value = 1, command = change)
lviv.grid(row = 1, column = 0, sticky = W)

dnipro = Radiobutton(text = 'Dnipro', variable = var, value = 2, command = change)
dnipro .grid(row = 2, column = 0, sticky = W)

odesa = Radiobutton(text = 'Odessa', variable = var, value = 3, command = change)
odesa.grid(row = 3, column = 0, sticky =W)

harkiv = Radiobutton(text = 'Kharkiv', variable = var, value = 4, command = change)
harkiv.grid(row = 4, column = 0, sticky = W)
root.mainloop()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-12-21
@Vindicar

if var == 0:
This won't work. Need
if var.get() == 0:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question