MCPcopy Create free account
hub / github.com/brain-workshop/brainworkshop / Message

Class Message

brainworkshop.py:663–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661
662messagequeue = [] # add messages generated during loading here
663class Message:
664 def __init__(self, msg):
665 if not 'window' in globals():
666 print(msg) # dump it to console just in case
667 messagequeue.append(msg) # but we'll display this later
668 return
669 self.batch = pyglet.graphics.Batch()
670 self.label = pyglet.text.Label(msg,
671 font_name=self.fontlist_serif,
672 color=cfg.COLOR_TEXT,
673 batch=self.batch,
674 multiline=True,
675 width=(4*window.width)/5,
676 font_size=calc_fontsize(14),
677 x=width_center(), y=height_center(),
678 anchor_x='center', anchor_y='center')
679 window.push_handlers(self.on_key_press, self.on_draw)
680 self.on_draw()
681
682 def on_key_press(self, sym, mod):
683 if sym:
684 self.close()
685 return pyglet.event.EVENT_HANDLED
686
687 def close(self):
688 return window.remove_handlers(self.on_key_press, self.on_draw)
689
690 def on_draw(self):
691 window.clear()
692 self.batch.draw()
693 return pyglet.event.EVENT_HANDLED
694
695def load_last_user(lastuserpath):
696 path = os.path.join(get_data_dir(), lastuserpath)

Callers 2

test_musicFunction · 0.85
brainworkshop.pyFile · 0.85

Calls

no outgoing calls

Tested by 1

test_musicFunction · 0.68