Last active
October 10, 2018 06:45
-
-
Save gottadiveintopython/c5e76cadac57d26d29fe29c0892e470c to your computer and use it in GitHub Desktop.
あえてpos_hintを使わずに中央揃えを試みる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
runTouchApp(Builder.load_string(''' | |
FloatLayout: | |
Button: | |
text: 'Kivy' | |
center: root.center | |
''')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
runTouchApp(Builder.load_string(''' | |
FloatLayout: | |
Button: | |
text: 'Kivy' | |
size_hint: None, None | |
center: root.center | |
''')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
runTouchApp(Builder.load_string(''' | |
FloatLayout: | |
Button: | |
text: 'Kivy' | |
size_hint: None, None | |
size: root.size | |
center: root.center | |
''')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.factory import Factory | |
root = Factory.FloatLayout() | |
button = Factory.Button(text='Kivy', size_hint=(None, None, )) | |
root.add_widget(button) | |
root.bind(size=button.setter('size'), center=button.setter('center')) | |
runTouchApp(root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
runTouchApp(Builder.load_string(''' | |
Widget: | |
Button: | |
text: 'Kivy' | |
size_hint: None, None | |
size: root.size | |
center: root.center | |
''')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
root = Builder.load_string(''' | |
FloatLayout: | |
Button: | |
text: 'Kivy' | |
x: root.center_x - self.width / 2 | |
y: root.center_y - self.height / 2 | |
size_hint: .5, .5 | |
''') | |
runTouchApp(root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
root = Builder.load_string(''' | |
FloatLayout: | |
Button: | |
text: 'Kivy' | |
right: root.center_x + self.width / 2 | |
top: root.center_y + self.height / 2 | |
size_hint: .5, .5 | |
''') | |
runTouchApp(root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
root = Builder.load_string(''' | |
FloatLayout: | |
Button: | |
text: 'Kivy' | |
center_x: root.center_x + self.width * 0 | |
center_y: root.center_y + self.height * 0 | |
size_hint: .5, .5 | |
''') | |
runTouchApp(root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.config import Config | |
Config.set('graphics', 'width', 400) | |
Config.set('graphics', 'height', 300) | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
root = Builder.load_string(''' | |
FloatLayout: | |
Button: | |
text: 'Kivy' | |
center: root.center or self.size | |
size_hint: .5, .5 | |
''') | |
runTouchApp(root) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment