Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created February 22, 2020 15:31
Show Gist options
  • Save tshirtman/637f80f6930d8c28be1325c73eaba4e0 to your computer and use it in GitHub Desktop.
Save tshirtman/637f80f6930d8c28be1325c73eaba4e0 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
KV = '''
#:import Window kivy.core.window.Window
<SizeButton@Button>:
target_size: 0, 0
text: str(self.target_size)
on_release: Window.size = self.target_size
BoxLayout:
SizeButton:
target_size: 640, 480
SizeButton:
target_size: 800, 600
SizeButton:
target_size: 1280, 720
SizeButton:
target_size: 1920, 1080
'''
class Application(App):
def build(self):
return Builder.load_string(KV)
if __name__ == "__main__":
Application().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment