cycleuser / kivy-cn Goto Github PK
View Code? Open in Web Editor NEWA Chinese Translation of Kivy Programming Guide Based on Kivy 1.9.2 中文翻译Kivy开发文档
A Chinese Translation of Kivy Programming Guide Based on Kivy 1.9.2 中文翻译Kivy开发文档
import kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
class layout(FloatLayout):
def init (self, **kwargs):
super(). init(**kwargs)
b1 = Button(
text = 'press me',
pos_hint ={'x': 0.2 , 'y': 0.1},
size_hint = (0.2, 0.1),
)
b1.bind(on_pressed =self.pressed)
l1= Label(
text = 'i am a label',
color =(1,0,0,1)
)
self.add_widget(b1)
self.add_widget(l1)
def pressed(self, elem):
b1.text ='hiiiii'
class myApp(App):
def build(self):
return layout()
myApp().run()
建议放到Gitbook上,章节阅读起来方便很多
import kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
class my_layout(BoxLayout):
def init (self, **kwargs):
super(). init (**kwargs)
self.rows=2
self.tb = TextInput(
text =''
)
self.add_widget(Label(text= 'hiii'))
self.add_widget(Label(text= 'hiii'))
self.bt1= Button(
text= 'press me!'
)
self.bt1.bind(on_pressed = self.create)
self.add_widget(self.bt1)
def create(self, instance):
self.lbl =Label (text = 'i am label')
self.add_widget(self.lbl)
self.remove_widget(self.bt1)
class myApp(App):
def build(self):
return my_layout()
if True:
myApp().run()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.