Answer the question
In order to leave comments, you need to log in
Porting from Tkinter to kivy Python?
Good day! Friends, the fact is that I made the Quiz game using tkinter under Windows. Now, I have a goal to "transfer" the code to the kivy frame and make a program for the Android system.
Code on tkinter (a stripped-down version of the quiz, there will be more questions in the original):
from tkinter import *
from tkinter import messagebox
win = Tk()
win.geometry("500x100")
def q1():
qu1 = Label(win, text='Привет. Ты готов?) Если да, то введи "Поехали"')
a1 = Entry()
bt1 = Button(win, text='Дальше', command=lambda: g1(q2))
qu1.grid(row=0)
a1.grid(row=1)
bt1.grid(row=2)
def g1(q2):
if a1.get().lower() == "поехали":
messagebox.showinfo("Начинаем!", "Отвечай максимально грамотно и четко. Если ответишь неправильно - сброс. Встретимся в конце)")
qu1.grid_forget()
q2()
else :
messagebox.showerror("Нетушки!", "Поехали введи, шо ты тут пишешь?)")
def q2():
qu2 = Label(win, text='2+2')
a2 = Entry()
bt2 = Button(win, text='Дальше', command=lambda: g2(q3))
qu2.grid(row=0)
a2.grid(row=1)
bt2.grid(row=2)
def g2(q3):
if a2.get().lower() == "4" :
messagebox.showinfo("Да!", "Ну это было слишком легко...")
qu2.grid_forget()
q3()
else :
messagebox.showerror("Нетушки!", "Неправильно!")
def q3():
qu3 = Label(win, text='Напиши слово правильно: Р@ЗД@ВАТЬ?')
a3 = Entry()
bt3 = Button(win, text='Дальше', command=lambda: g3(q3))
qu3.grid(row=0)
a3.grid(row=1)
bt3.grid(row=2)
def g3(q3):
if a3.get().lower() == "раздавать" :
messagebox.showinfo(":)", "Викторина пройдена!")
else :
qu3.grid_forget()
q2()
messagebox.showerror("Нетушки!","Неправильно!")
q1()
win.title("Test")
win.mainloop()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question