Created
April 12, 2020 13:08
-
-
Save Mrestof/609d628f36e6061dea8bea560f979a46 to your computer and use it in GitHub Desktop.
Position problems
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
<ScatterTextWidget>: | |
FloatLayout: | |
id: my_flayout | |
canvas: | |
Color: | |
rgba: 0, 1, 0, 1 | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
Scatter: | |
id: my_scatter | |
size_hint: None, None | |
size: 300, 100 | |
canvas.after: | |
Color: | |
rgb: 1, 0, 1 | |
Rectangle: | |
pos: self.pos | |
size: self.size |
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.app import App | |
from kivy.uix.boxlayout import BoxLayout | |
class ScatterTextWidget(BoxLayout): | |
pass | |
class LearningApp(App): | |
def build(self): | |
root_widget = ScatterTextWidget() | |
scat = root_widget.ids['my_scatter'] | |
fllt = root_widget.ids['my_flayout'] | |
print(scat.center) | |
print(fllt.center) | |
scat.center = fllt.center | |
print(scat.center) | |
print(fllt.center) | |
return root_widget | |
if __name__ == "__main__": | |
LearningApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment