コード例 #1
0
ファイル: MainFile.py プロジェクト: yw-zhou/BadmintonTryouts
def scrollaround(data, stend, data2=None):
    #using the coordinates of the scroll bar update the menu to show the according data
    tempmn = Menu(1, len(data), 300, 600, [0, 0], (0, 200),
                  [lightgrey, darkgrey] * (len(data) // 2) + [lightgrey] *
                  (len(data) % 2), ['text'] + data[stend[0]:stend[1]], 950, 60,
                  40)
    if data2 != None:
        tempmn.secondtext = data2[stend[0]:stend[1]]
        tempmn.secpad = 700
    return tempmn
コード例 #2
0
ファイル: MainFile.py プロジェクト: yw-zhou/BadmintonTryouts
def makemenu(data):
    #using the data make a universal menu
    if len(data) > 10: lend = 10
    else: lend = len(data)
    menua = Menu(1, len(data), 300, 600, [0, 0], (0, 200),
                 [lightgrey, darkgrey] * (len(data) // 2) + [lightgrey] *
                 (len(data) % 2), ['text'] + data[scroll:scroll + 11], 950, 60,
                 40)
    menub = Menu(1, lend, 300, 600, [0, 20], (850, 210), [red] * lend,
                 ['text'] + ['delete'] * 10, 80, 40, 35)
    return (menua, menub)
コード例 #3
0
def main():
    pg.init()
    pg.mixer.init()

    soundPlayer = Mixer()

    menu = Menu(soundPlayer)
    while not menu.start:
        menu.update()

    playing = GameController(soundPlayer)
    playing.main()
コード例 #4
0
    def Cursor_connection(self, connection):
        dbquery = DbRequests.DbRequests()
        menu = Menu.Menu()

        try:
            with connection.cursor(pymysql.cursors.DictCursor) as cursor:
                # Data base insert
                Result_category = dbquery.Presence_query(cursor, TCATEGORY)
                Result_aliment = dbquery.Presence_query(cursor, TALIMENT)

                # Results presence of categories and aliments
                # in database tables
                if Result_category == 0 or Result_category is None:
                    dbquery.Insert_category(cursor)
                if Result_aliment == 0 or Result_aliment is None:
                    dbquery.Insert_ingredients(cursor)
                connection.commit()

                try:
                    # console menu
                    menu.menu(cursor, connection)

                except Exception as e:
                    print("Error with menu: " + str(e))

                # connection is not autocommit by default.
                # So you must commit to save your changes.
                connection.commit()
        finally:
            connection.close()
            cursor.close()

        return cursor
コード例 #5
0
ファイル: Main.py プロジェクト: chrobryknur/MariuszSuperBrat
 def __init__(self):
     pygame.init()
     pygame.display.set_caption('Mariusz Super Brat')
     self.windowSize = (800, 600)
     self.window = pygame.display.set_mode(self.windowSize)
     self.GameStates = [Menu.Menu(self.windowSize)]
     self.prev_state = -2
     self.handle = True
     self.currentGameState = self.GameStates[MAIN_MENU]
コード例 #6
0
ファイル: MainFile.py プロジェクト: yw-zhou/BadmintonTryouts
screen = pygame.display.set_mode((1000, 800))
smallfont = pygame.font.Font(None, 42)
white, black, lightgrey, darkgrey, red = (255, 255,
                                          255), (0, 0, 0), (200, 200,
                                                            200), (100, 100,
                                                                   100), (255,
                                                                          0, 0)
mode = 1
playerlist, total = [], 10
done = False
#mode 1: Title Screen
titlefont = pygame.font.SysFont("Arial Black", 110)
title = ["Badminton", "Tryout", "Software"]
title = [titlefont.render(x, True, black) for x in title]
titlepos = [(100, 80), (250, 180), (400, 280)]
startmn = Menu(2, 1, 300, 600, [100, 0], (300, 450), [lightgrey] * 2,
               ['text', 'Start', 'Load'], 200, 100, 60)

#mode 2: Input Team Name
subfont = pygame.font.SysFont("Arial Black", 50)
insertnametxt = subfont.render("Team Name:", True, white)
teaminpt = InputBox(280, 300, 430, 60, [white, black],
                    pygame.font.Font(None, 60))
teammn = Menu(2, 1, 300, 600, [80, 0], (310, 400), [lightgrey] * 2,
              ['text', 'Back', 'OK'], 150, 60, 40)
overlap = False
overlaptxt = smallfont.render("Already Exists or Slots Full", True, white)

#mode 3: Load Team Selection
readteams = open('Teams.txt', 'r')
teamloadlist = []
for x in range(6):
コード例 #7
0
 def __init__(self):
     self.WindowConfig = WindowConfiguration(800, 600)
     self.GameStates = (M.Menu(self.WindowConfig.size()), Game(),
                        GameOver())
コード例 #8
0
from Classes.Menu import *

menu = Menu()
コード例 #9
0
import pygame
from Classes import Menu
from Classes import Game
import settings

close = False
pygame.init()
screen = pygame.display.set_mode(
    (settings.window_height, settings.window_width))
while not close:
    settings.level = 4
    while settings.level == 4:
        Menu.Menu().open_menu(screen)
        settings.level = Menu.Menu().level_menu(screen)
    close = Game.Game().play(screen, pygame.time.get_ticks())