Advertisement
Guest User

show_labels

a guest
Feb 20th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. def show_labels(prefix = u""):
  2.  
  3.         labels = [
  4.             lbn
  5.             for lbn in renpy.get_all_labels().get_rollback()
  6.             if lbn.lower().startswith(prefix)
  7.             ]
  8.  
  9.         labels.sort()
  10.         xadjustment = ui.adjustment()
  11.         yadjustment = ui.adjustment()
  12.  
  13.         while True:
  14.  
  15.             ui.frame()
  16.             ui.vbox()
  17.  
  18.             layout.label(_(u"Labels which starts with " + prefix), None)
  19.  
  20.             ui.textbutton(_(u"Close"), clicked=ui.returns(False), size_group="labels")
  21.  
  22.             ui.side(['c', 'b', 'r'], spacing=5)
  23.             vp = ui.viewport(xadjustment=xadjustment, yadjustment=yadjustment, mousewheel=True)
  24.  
  25.             ui.vbox()
  26.  
  27.             for lbn in labels:
  28.                 ui.button(clicked=ui.returns(lbn), size_group="labels", xminimum=1.0)
  29.                 ui.text(lbn, style="button_text", xalign=0.0)
  30.  
  31.             ui.close()
  32.  
  33.             ui.bar(adjustment=xadjustment, style='scrollbar')
  34.             ui.bar(adjustment=yadjustment, style='vscrollbar')
  35.             ui.close()
  36.  
  37.             ui.close()
  38.  
  39.             rv = ui.interact()
  40.  
  41.             if rv is False:
  42.                 return
  43.  
  44.             renpy.jump(rv)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement