Exemplo n.º 1
0
 def printhelp(self, grid, start, secs):
     helpfile = open('pygamehelp')
     inbox = InputBox(self.screen,
                      boxw=260,
                      boxh=220,
                      cb=self.pstats,
                      cbargs=(grid, start, secs))
     val = inbox.show(helpfile.read())
     if val:
         if val.type == pygame.QUIT:
             return 'quit'
Exemplo n.º 2
0
                else:
                    events.append(e)
            nkpy.handle_events(events)

            # Show the demo GUI.
            if pynk.lib.nk_begin(nkpy.ctx, WIN_CAPTION.encode('utf-8'), pynk.lib.nk_rect(0, 0, d_width, d_height), 0):
                pynk.lib.nk_layout_row_dynamic(nkpy.ctx, 0, 2)
                pynk.lib.nk_label(
                    nkpy.ctx, b"Connection Status", pynk.lib.NK_TEXT_LEFT)
                nkpy.ctx.style.text.color = conn_color
                pynk.lib.nk_label(nkpy.ctx, conn_status,
                                  pynk.lib.NK_TEXT_RIGHT)
                nkpy.ctx.style.text.color = text_color

                pynk.lib.nk_layout_row_dynamic(nkpy.ctx, 0, 2)
                data_box.show(nkpy)

                drawValues(nkpy.ctx, values)
            pynk.lib.nk_end(nkpy.ctx)

            # Draw
            screen.fill((0, 0, 0))
            nkpy.render_to_surface(screen)
            pygame.display.update()

            # Clear the context for the next pass.
            pynk.lib.nk_clear(nkpy.ctx)

    # Shutdown.
    pygame.quit()