def main(): """ This is the main method which call the main screen consisting of the GUI :return:nothing """ app = MainScreen() app.display()
def __init__(self): self.__Window = tkinter.Tk() self.__Window.attributes('-fullscreen', self.__FullScreenState) self.__Window.title('Identity Check') self.__Window.bind("<F11>", self.__ToggleFullScreen) self.__Window.bind("<Escape>", self.__QuitFullScreen) self.__Window.bind('<q>', self.__QuitApplication) self.__LockScreen = LockScreen(self.__Window) self.__LockScreen.RaiseEvent = self.RaiseEvent self.__MainScreen = MainScreen(self.__Window) self.__MainScreen.RaiseEvent = self.RaiseEvent
def __init__(self, config, core): super(FrontendAdafruitCharLCDPlate, self).__init__() self.input_manager = InputManager() self.display_object = DisplayObject() if True: import Adafruit_CharLCD as LCD self.display = LCD.Adafruit_CharLCDPlate() else: from web_socket_lcd_simulator import WebSockectLCDSimulator self.display = WebSockectLCDSimulator() self.main_screen = MainScreen(core) self.running = True
def build(self): self.title = 'Text Translation' self.sm = ScreenManager() self.main_screen = MainScreen(name="main screen") def move_to_main(session_id = 0): self.sm.switch_to(self.main_screen) self.main_screen.session_id = session_id self.login_screen = LoginScreen(switch_main_callback=move_to_main, name="Login screen") self.sm.switch_to(self.login_screen) return self.sm
def main(self): # load big resources first cardPath = os.path.join(os.getcwd(), "res", "cardData.json") allCardData = None with open(cardPath, 'r', encoding="utf-8") as f: allCardData = json.load(f) # SET UP THE GRAPHICS WINDOW window = sf.RenderWindow(sf.VideoMode(1100, 800), 'Mana Burn') window.framerate_limit = 60 window.clear() view = sf.View() view.reset(sf.Rectangle((0, 0), (1100, 850))) window.view = view window.display() # figure out the save game situation currentSavedGame = SavedGame() currentScreen = MainScreen(window, view, currentSavedGame, allCardData) # A clock runs and cleans up dead objects periodically cleanupClock = sf.Clock() # THE UPDATE AND GAME LOOP while window.is_open: for event in window.events: if type(event) is sf.CloseEvent: window.close() if type(event ) is sf.KeyEvent and event.code is sf.Keyboard.ESCAPE: window.close() if type(currentScreen) is MainScreen: if type(event) is sf.MouseButtonEvent: currentScreen.checkClicks(window, event) if type(event) is sf.MouseWheelEvent: currentScreen.checkScroll(window, event) window.clear() currentScreen.update() window.display() if cleanupClock.elapsed_time.seconds >= .5: currentScreen.cleanUp() cleanupClock.restart()
# -*- coding: utf-8 -*- """ Created on Wed Jul 4 17:05:03 2018 @author: Sander Oosterveld """ import pygame from MainScreen import MainScreen from queue import Queue q = Queue() screen = MainScreen(q) musicFile = 'disturbed.ogg' pygame.mixer.init() pygame.mixer.music.load(musicFile) pygame.mixer.music.play() screen.start() pygame.mixer.quit()
from kivy.core.window import Window # This sets the window to size (800,800) Window.size = (800, 700) # Sets the colour of the window background Window.clearcolor = (0.2, 0.2, 0.2, 0.5) from kivy.app import App from kivy.uix.screenmanager import ScreenManager, Screen from kivy.lang import Builder from MainScreen import MainScreen from EditScreen import EditScreen # Creates new instances of the MainScreen and EditScreen MainScreen = MainScreen() EditScreen = EditScreen() # MapScreen class -- responsible for th class MapScreen(Screen): # Returns coordinates of mouse on the screen def __init__(self, **kwargs): super(MapScreen, self).__init__(**kwargs) # Binds the mouse_pos() function to the window -- the coordinates of the mouse is continuously retrieved. Window.bind(mouse_pos=self.mouse_pos) # Done by Gan Shyan # This function retrieves the coordinates of the mouse cursor on the map def mouse_pos(self, window, pos): self.ids.cursor_coordinate_id.text = "Cursor: " + str(pos)