Creating A Keypad

19 views
Skip to first unread message

Chris Chenoweth

unread,
Sep 27, 2018, 11:18:53 PM9/27/18
to Kivy users support
So I'm pretty new to python and even more Kivy. I'm just trying to make a keypad that accepts numbers and prints a line if type in the right code. And what i set up is sending me all sorts of errors. Please help me out.

from kivy.config import Config
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout

Config.set('graphics', 'width', 300)
Config.set('graphics', 'height', 300)
Config.set('graphics', 'resizable', 'False')
Config.set('graphics', 'borderless', 'True')


class KeyPad(App):

def build(self):
layout = GridLayout(cols=3)

btn1 = Button(text='1')
btn2 = Button(text='2')
btn3 = Button(text='3')
btn4 = Button(text='4')
btn5 = Button(text='5')
btn6 = Button(text='6')
btn7 = Button(text='7')
btn8 = Button(text='8')
btn9 = Button(text='9')
layout.add_widget(btn1)
layout.add_widget(btn2)
layout.add_widget(btn3)
layout.add_widget(btn4)
layout.add_widget(btn5)
layout.add_widget(btn6)
layout.add_widget(btn7)
layout.add_widget(btn8)
layout.add_widget(btn9)
return layout, verification(btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9)


actual_password = ["btn1", "btn2", "btn3", "btn4"]


def verification(b1, b2, b3, b4, b5, b6, b7, b8, b9):
return


KeyPad().run()

Глеб Самойлов

unread,
Sep 28, 2018, 12:44:44 AM9/28/18
to Kivy users support
from kivy.config import Config
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout

Config.set('graphics', 'width', 300)
Config.set('graphics', 'height', 300)
Config.set('graphics', 'resizable', 'False')
Config.set('graphics', 'borderless', 'True')


class KeyPad(App):

   
def build(self):
        layout
= GridLayout(cols=3)

       
for i in range(1, 10):
            layout
.add_widget(
               
Button(
                   
text=str(i),
                    on_press=verification))

       
return layout


actual_password
= ["btn1", "btn2", "btn3", "btn4"]


def verification(instance):
   
print(instance)


KeyPad().run()



Although the question is not clear.
пятница, 28 сентября 2018 г., 6:18:53 UTC+3 пользователь Chris Chenoweth написал:

Will Tejeda

unread,
Sep 28, 2018, 12:47:53 AM9/28/18
to kivy-...@googlegroups.com
I thinkt he idea is that you'd collect the key press buttons and place them in a list and then compare that list to the "actual_password" 

and if they match , it would print out something like " password correct" 

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/e675a604-4cd7-4528-9126-edd0232b6d5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages