Kivy İle Matematik Soru Uygulaması Yapımı

Jul 4, 20212 dakika

bunu okuldaki bir sunum için hazırlamıştım



resimler











kodları



from kivy.app import App

from kivy.uix.label import Label

from kivy.uix.gridlayout import GridLayout

from kivy.uix.button import Button

from kivy.uix.widget import Widget

from sys import exit



class content(GridLayout):



def __init__(self):

super().__init__()

self.widgets()



def widgets(self):



self.cols=3

self.buttons=list()

self.correctCount=0



self.data={"quesOne":{"ques":"2x+5=9","stylish":["A)2","B)3","C)4"],"reply":0},

"quesTwo":{"ques":"x/2+1=7","stylish":["A)14","B)18","C)12"],"reply":2},

"quesThree":{"ques":"x/3+x/2=5","stylish":["A)3","B)6","C)9"],"reply":1}}



for i in ["quesOne","quesTwo","quesThree"]:

for j in range(3):



button=Button(text=self.data[i]["stylish"][j])

self.buttons.append(button)



if i=="quesOne" and j==self.data[i]["reply"]:

button.bind(on_press=self.correct)



elif i=="quesTwo" and j==self.data[i]["reply"]:

button.bind(on_press=self.correct)



elif i=="quesThree" and j==self.data[i]["reply"]:

button.bind(on_press=self.correct)



self.widgetList=[Widget(),Label(text=self.data["quesOne"]["ques"]),Widget(),self.buttons[0],self.buttons[1],self.buttons[2],

Widget(),Label(text=self.data["quesTwo"]["ques"]),Widget(),self.buttons[3],self.buttons[4],self.buttons[5],

Widget(),Label(text=self.data["quesThree"]["ques"]),Widget(),self.buttons[6],self.buttons[7],self.buttons[8]]



for widget in self.widgetList:

self.add_widget(widget)



def correct(self,btn):



self.correctCount+=1



if self.correctCount==3:



label=Label(text="Full ")

button=Button(text="Çık")

button.bind(on_press=exit)



self.widgetList=[Widget(),label,Widget(),Widget(),button,Widget()]



for widget in self.widgetList:

self.add_widget(widget)



class main(App):



def build(self):

return content()



if __name__ == '__main__':

main=main()

main.run()



Küçük bir destek binlerce beğeniden daha değerlidir
https://bylge-images.s3-eu-west-1.amazonaws.com/8a860ee0-ebb9-11ea-98cf-0d9846403006.jpeg
Python

a={ "yas":12, "dil":"Python", "kütüphane":[pygame,kivy], "sıkılma durumu":True } print(a)

Bylge Icon
Bylge Icon