Answer the question
In order to leave comments, you need to log in
How do I fix too many values to unpack (expected 2) error?
I am making a translator of the wrong keyboard layout, in the program I need to make it so that when certain buttons are pressed, some variable refers to the list, but when launched it gives an error: too many values to unpack (expected 2)
Here is an excerpt from the program ...
lan1 = []
lan2 = []
but1=Button(root, text="Английский => Русский", bg = 'grey')
but1.place(x=10, y=285)
Eng = "`qwertyuiop[]asdfghjkl;'zxcvbnm,.~QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>!&?/^@()1234567890-=+\ "
Rus = "ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ!?,.:\"()1234567890-=+\ "
def but1_click(event):
global lan1, lan2
lan1 = Eng, lan2 = Rus
but1.bind('<Button-1>', but1_click)
Answer the question
In order to leave comments, you need to log in
lan1 = Eng, lan2 = Rus
Where did you learn this?
Or like this:
lan1 = Eng
lan2 = Rus
lan1, lan2 = Rus, Eng
lan1 = Eng, lan2 = Rus
You can't assign variables like that. And in general, maybe you did something wrong?
You created two lists lan1 and lan2, created two string variables, and then assigned values from Eng and Rus to these lists.
Hence the questions, why make lists if they are not lists, and is such a gap in the form of lan variables necessary? Why not just use Rus/Eng
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question