Skip to content

Instantly share code, notes, and snippets.

@gottadiveintopython
Last active July 8, 2018 20:20
Show Gist options
  • Save gottadiveintopython/17e041376b9f291abda2e969243d3b0f to your computer and use it in GitHub Desktop.
Save gottadiveintopython/17e041376b9f291abda2e969243d3b0f to your computer and use it in GitHub Desktop.
OpenGL contextの消失への対応(WIP)
from __future__ import print_function
from kivy.config import Config
Config.set('kivy', 'pause_on_minimize', 1)
# Config.set('graphics', 'fullscreen', 1)
from kivy.app import App
from kivy.factory import Factory
from kivy.graphics.texture import Texture
import kivy.core.window
from sys import stderr
class TestApp(App):
def build(self):
texture = Texture.create(size=(2, 2, ), colorfmt='rgb')
texture.blit_buffer(
b'\xff\xff\xff' # White
b'\xff\x00\x00' # Red
b'\x00\xff\x00' # Green
b'\x00\x00\xff', # Blue
colorfmt='rgb')
return Factory.Image(texture=texture, keep_ratio=False, allow_stretch=True)
def on_pause(self):
print('on_pause', file=stderr)
return True
def on_resume(self):
print('on_resume', file=stderr)
def on_start(self):
print('on_start', file=stderr)
def on_stop(self):
print('on_stop', file=stderr)
if __name__ == '__main__':
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment