示例#1
0
 def __init__(self, app):
     super(Interface, self).__init__(app)
     backdrop = pygame.Surface(app.screenManager.scaledSize)
     backdrop.fill((128, 0, 128))
     i1 = prompt.InputBox(self.app,
                          Area((40, 40), (300, 50)),
                          'Mouse Over',
                          font=Font("KLEPTOCR.TTF", 36))
     i1.onClick.addListener(self.setFocus)
     i2 = prompt.InputBox(self.app,
                          Area((340, 140), (200, 50)),
                          'Mouse Over',
                          font=Font("KLEPTOCR.TTF", 36))
     i2.onClick.addListener(self.setFocus)
     h1 = hint.Hint(self.app, "You absolutely\nRULE!", i1,
                    Font("KLEPTOCR.TTF", 24))
     h2 = hint.Hint(self.app, "Like, amazingly so!! TROSNOTH!@!!@!", i2,
                    Font("KLEPTOCR.TTF", 24))
     h3 = hint.Hint(
         self.app,
         "A secret!\nWell done, you have found a magical land of wonder and amazement!! \nYou win absolutely nothing, but at least you have a good story to tell now.",
         pygame.Rect(500, 400, 100, 50), Font("KLEPTOCR.TTF", 24))
     self.elements = [
         elements.PictureElement(app, backdrop), i1, h1, i2, h2, h3
     ]
    def __init__(self, app):
        super(Interface, self).__init__(app)
        backdrop = pygame.Surface(app.screenManager.scaledSize)
        backdrop.fill((128, 0, 128))
        f = open('credits.txt', 'r')
        credPos = (50, 50)
        size = (500, 350)
        fonts = {
            'body': self.app.fonts.creditsFont,
            'h1': self.app.fonts.creditsH1,
            'h2': self.app.fonts.creditsH2
        }
        cred = scrollingText.ScrollingText(self.app,
                                           credPos,
                                           size,
                                           f.read(), (0, 0, 0),
                                           fonts,
                                           bgColour=(255, 255, 255),
                                           autoScroll=False,
                                           speed=100,
                                           align='middle',
                                           border=True,
                                           loop=True)

        def doIt():
            print("Done Scrolling")

        cred.onFinishedScrolling.addListener(lambda: doIt())

        self.elements = [elements.PictureElement(app, backdrop), cred]
示例#3
0
    def __init__(self, app):
        super(Interface, self).__init__(app)

        # Draw the background
        bg = pygame.surface.Surface(app.screenManager.scaledSize)
        bg.fill((0, 128, 0))
        from random import randint
        for x in range(0, 20):
            randPos = (randint(0, 580), randint(0, 430))
            pygame.draw.rect(bg, (255, 0, 0),
                             pygame.rect.Rect(randPos, (20, 20)), 10)
        box = FunBox(app, "Disgusting Colour Scheme?")
        box._setPos((0, 0))

        box2 = FunBox(app, "Heck Yes!")
        box2.setColours(borderColour=(192, 0, 192))
        box3 = FunBox(app, "")
        box3._setPos((10, 10))
        box4 = YesNoBox(app, (300, 200), "A question: ", "Is Trosnoth cool?")
        box4.onClose.addListener(
            lambda: OkBox(app, (200, 100), "Result", "You pressed %s" %
                          DialogResult.text[box4.result]).show())
        self.elements = [elements.PictureElement(app, bg)]
        box.onClose.addListener(lambda: self.app.screenManager.
                                setScreenProperties((1024, 768), 0, "Testing"))
        box3.show()
        box.show()
        box2.show()
        box4.show()
示例#4
0
    def __init__(self, app):
        super(Interface, self).__init__(app)
        backdrop = pygame.Surface(app.screenManager.scaledSize)
        backdrop.fill((128,0,128))

        con = console.TrosnothInteractiveConsole(app, Font(None, 18),
                Area((0, 200), (500, 200)))
        con.interact().addCallback(self.done)
                        
        self.elements = [elements.PictureElement(app, backdrop), con]
        self.setFocus(con)
 def __init__(self, app):
     super(Interface, self).__init__(app)
     backdrop = pygame.Surface(app.screenManager.scaledSize)
     backdrop.fill((128, 0, 128))
     s1 = slider.Slider(app, ScaledArea(100, 100, 400, 60))
     #s1.setRange(50,150)
     t1 = elements.TextElement(app, "100", Font(None, 60),
                               ScaledLocation(100, 200))
     t2 = elements.TextElement(app, "100", Font(None, 60),
                               ScaledLocation(550, 100))
     onSlide = lambda x: t1.setText("%.1f" % x)
     onChange = lambda x: t2.setText("%.1f" % x)
     s1.onSlide.addListener(onSlide)
     s1.onValueChanged.addListener(onChange)
     self.elements = [elements.PictureElement(app, backdrop), s1, t1, t2]
示例#6
0
 def __init__(self, app):
     super(Interface, self).__init__(app)
     backdrop = pygame.image.load('Awesome Leaders.jpg').convert()
     x, y = backdrop.get_size()
     size = Size(x, y)
     sc1 = scrollableCanvas.ScrollableCanvas(app, ScaledLocation(20,20), size, ScaledSize(200,200))
     sc2 = scrollableCanvas.ScrollableCanvas(app, ScaledLocation(230,20), size, ScaledSize(200,y+scrollableCanvas.ScrollBar.defaultWidth))
     sc3 = scrollableCanvas.ScrollableCanvas(app, ScaledLocation(440,20), size, ScaledSize(x,y))
     sc4 = scrollableCanvas.ScrollableCanvas(app, ScaledLocation(20,530), size, ScaledSize(x+scrollableCanvas.ScrollBar.defaultWidth, 200))
     #sc5 = scrollableCanvas.ScrollableCanvas(app, ScaledLocation(20,530), size, ScaledSize(x+scrollableCanvas.ScrollBar.defaultWidth, y))
     self.elements = [sc1, sc2, sc3, sc4]#, sc5]
     font = Font("KLEPTOCR.TTF", 30)
     onclick = lambda sender: self.app.screenManager.setScreenProperties((1680, 1050), 0, "Testing")
     for sc in self.elements:
         sc.elements = [elements.PictureElement(app, backdrop, Location(scrollableCanvas.ScrollableCanvasAttachedPoint(sc, (0,0)), 'topleft')),
                        elements.TextButton(app, Location(scrollableCanvas.ScrollableCanvasAttachedPoint(sc, (20,20))), "Hello", font, (0,128,0), (0,0,128), onClick = onclick)]
示例#7
0
 def __init__(self, app):
     super(Interface, self).__init__(app)
     bg = pygame.surface.Surface((1024,768))
     bg.fill((255,255,0))
                                                                  
     font = Font("KLEPTOCR.TTF", 30)
     tc = tabContainer.TabContainer(app, ScaledArea(10,10, 1004, 748), font, (0,128,0))
     background = SizedImage('Awesome Leaders.jpg', tabContainer.TabSize(tc))
     for x in range(0,1):
         t1 = tab.Tab(app, "Hellooooooooo")
         t1.elements = [elements.PictureElement(app, background, Location(AttachedPoint((0,0),tc._getTabRect,'topleft'),'topleft'))]
         t2 = NewTab(app, tc)
         t3 = EpilepticTab(app, tc)
         tc.addTab(t1)
         tc.addTab(t2)
         tc.addTab(t3)
     #tc._setTabHeaderDimensions(3,36,24,200)
     self.elements = [elements.Backdrop(app, bg), tc]
示例#8
0
    def __init__(self, app):
        super(Interface, self).__init__(app)
        backdrop = pygame.Surface(app.screenManager.scaledSize)
        backdrop.fill((128, 0, 128))
        self.val = 4
        self.l = ['hello', self.val]
        getColour = lambda item: ((255, 0, 0),
                                  (0, 255, 255))[str(item).startswith('h')]
        font = Font("KLEPTOCR.TTF", 30)
        self.s = statList.StatList(app,
                                   Location((550, 400), 'bottomright'),
                                   self.l,
                                   font,
                                   colourFunction=getColour,
                                   align='right')

        self.s.setVisible()

        f = lambda: self.s.setVisible(not self.s.getVisibility())

        h = hotkey.Hotkey(app, pygame.K_s, 0)
        h.onTriggered.addListener(f)
        self.elements = [elements.PictureElement(app, backdrop), self.s, h]