def calc_question():
    global text1, text2, expression
    text = "Input expression:"

    if Var.keyENTER:
        Var.Answer = Thing.Input2.get_text()
        try:
            #global text1, text2
            expr = Var.Answer
            expr = sympify(expr)
            deriv = diff(expr, x)
            text1 = "Derivative: " + str(deriv)
            integ = integrate(expr, x)
            text2 = "Integral: " + str(integ)
            Var.keyENTER = False
            Thing.Input2.clear_text()
            expression = "Expression: " + str(Var.Answer)
        except:
            text1 = "Sorry, input typed wrong"

    Thing.show_text(text, (430, 260), 20, (0, 0, 0))

    Thing.show_text(expression, (370, 180), 20, (0, 0, 0))
    Thing.show_text(text1, (370, 200), 20, (0, 0, 0))
    Thing.show_text(text2, (370, 220), 20, (0, 0, 0))
        if event.type == pygame.MOUSEBUTTONDOWN:
            Var.mouseDOWNPOS = Var.mousePOS
            Var.mouseDOWN = True
        else:
            Var.mouseDOWN = False


RUNNING = True
while RUNNING == True:
    variables()
    Var.mousePOS = pygame.mouse.get_pos()

    Sprite.DISPLAY.fill((60, 70, 80))

    if Var.in_class == True:
        Thing.shoot_zombies()

    elif Var.you_died == True:
        Thing.you_died()

        event_loop()

    elif Var.calculator == True:
        Thing.calculator()

        event_loop()

    elif Var.menu == True:
        Thing.do_menu()
        #BEWARE! Pygame will "not respond" and crash if no event loop is taking place (assumption by OS). Use below if you want no event to be registered
        # pygame.event.pump()
Beispiel #3
0
        Var.keyRIGHT = True

    if not keyDOWN:
        Var.keyDOWN = False
    if not keyUP:
        Var.keyUP = False
    if not keyLEFT:
        Var.keyLEFT = False
    if not keyRIGHT:
        Var.keyRIGHT = False

    if keys[pygame.K_LSHIFT]:
        Var.keyLSHIFT = True

    if not keys[pygame.K_LSHIFT]:
        Var.keyLSHIFT = False


RUNNING = True
while RUNNING == True:
    variables()
    Var.mousePOS = pygame.mouse.get_pos()

    Thing.shoot_zombies()

    pygame.draw.rect(Sprite.DISPLAY, (200, 10, 15), Sprite.Player.colliderect,
                     2)

    pygame.display.update()
    fpsClock.tick(FPS)
Beispiel #4
0
    if keys[pygame.K_LSHIFT]:
        Var.keyLSHIFT = True

    if not keys[pygame.K_LSHIFT]:
        Var.keyLSHIFT = False

RUNNING = True
while RUNNING == True:
    variables()
    Var.mousePOS = pygame.mouse.get_pos()
    
    Sprite.DISPLAY.fill((60,70,80))
    Sprite.objList.update()
    Sprite.Player.update()
    
    # Note, please change layers depending on y value: https://www.reddit.com/r/pygame/comments/3de4ng/challenge_drawing_in_the_right_order/
    # Answer: https://github.com/iminurnamez/draw-order-challenge/commit/387da00cf21e63d0cddee61737df3edd91aa59b4
    
    pygame.draw.rect(Sprite.DISPLAY, (200, 10, 15), Sprite.Player.colliderect, 2)



    Sprite.drawSprites(Sprite.spritesList)

    Thing.update_input()
    Calculus.show_question()
    
    pygame.display.update()
    fpsClock.tick(FPS)
Beispiel #5
0
            Var.mouseDOWN = False


# draw a cool cursor
pygame.mouse.set_visible(False)
cursor = pygame.image.load(os.path.join('Stuff', 'Cursor.png'))

RUNNING = True
while RUNNING == True:
    variables()
    Var.mousePOS = pygame.mouse.get_pos()

    Sprite.DISPLAY.fill((60, 70, 80))

    if Var.in_class == True:
        Thing.shoot_zombies()

    elif Var.tutorial_class == True:
        Thing.tutorial_class()

        event_loop()

    elif Var.you_died == True:
        Thing.you_died()

        event_loop()

    elif Var.calculator == True:
        Thing.calculator()

    elif Var.lesson == True: