我想从Kivy开始,因为我用Python编写代码,但我发现它真的很难!你能解释一下它是如何工作的吗? 例如,即使这看起来很模糊(这是他们网站的第二个例子)。
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
class LoginScreen(GridLayout):
def __init__(self, **kwargs):
super(LoginScreen, self).__init__(**kwargs)
self.cols = 2
self.add_widget(Label(text='User Name'))
self.username = TextInput(multiline=False)
self.add_widget(self.username)
self.add_widget(Label(text='password'))
self.password = TextInput(password=True, multiline=False)
self.add_widget(self.password)
class MyApp(App):
def build(self):
return LoginScreen()
if __name__ == '__main__':
MyApp().run()
我想从一个基本的应用程序开始,它要求用户输入并显示从中创建的内容。 例如,在没有任何GUI的basic Python中,它可以是:
def hex_enc(text_input):
return text_input.encode('hex')
def hex_dec(text_input):
return text_input.decode('hex')
while True:
text_input = raw_input('Input : ')
mode = raw_input('Mode : ').lower()
if ('encrypt' in mode):
print hex_enc(text_input)
else:
print hex_dec(text_input)
我想我需要一个文本输入和一个标签,这将是文本输入的结果。 但这是非常混乱,我不知道,并利用所有的基维类!
目前没有回答
相关问题 更多 >
编程相关推荐