예제 #1
0
def accept_loop(w, s):
    w.print(0, "Started accept loop")
    s.settimeout(1)
    while running:
        try:
            client, addr = s.accept()
            screen = screens.Screen()
            w.add_screen(screen)

            t1 = threading.Thread(
                target=lambda: follow_client(screen, client, addr, w))
            t1.start()
            threads.append(t1)
        except socket.timeout:
            pass
    w.print(0, "Closing down...")
예제 #2
0
파일: vic_ii.py 프로젝트: jesseward/py64
 def __init__(self, C64, MMU, CIA2, char_ROM):
     self.B_can_write = True  # in the instance because of ShedSkin
     self.MMU = MMU
     self.C64 = C64
     self.char_ROM = char_ROM
     self.CIA2 = CIA2
     self.B_active = True
     self.B_bitmap = False
     self.control_1 = 0
     self.control_2 = 0
     self.B_clip_address = False  # FIXME default?
     self.B_MCM = False  # FIXME default?
     self.props = Settings()
     self.MSB_X = 0
     #self.set_control_1(0)  # FIXME default.
     #self.set_control_2(0)  # FIXME default.
     palette.get_RGBA32_pixel(0)
     self.screen = screens.Screen(self, CIA2)
     self.screen.get_rendered_pixbuf()  # ShedSkin
예제 #3
0
    def call_screen(self):
        # print(type(self.mode.get()))
        # print(self.mode.get())
        m = int(self.mode.get())

        self.req_screen = screens.Screen(m)
def main():

    # initialize pygame
    pygame.init()

    # create the window and set the caption of the window
    window_sfc = pygame.display.set_mode((window_wid, window_hgt))
    pygame.display.set_caption('No Pain No Gain')

    # create a clock
    clock = pygame.time.Clock()

    # this is the initial game state
    next_state = STATE_TITLE

    #####################################################################################################
    # these are the initial game objects that are required (in some form) for the core mechanic provided
    #####################################################################################################
    start_button = entitys.Button([(window_sfc.get_width() / 2 - 50,
                                    window_sfc.get_height() / 2 - 50),
                                   (100, 100)])
    title = screens.Screen(
        ["tittle", start_button, "No Pain No Gain", None, 3])

    continue_button = entitys.Button([(window_sfc.get_width() / 2 - 50,
                                       window_sfc.get_height() / 2 - 50),
                                      (100, 100)])
    cutscene = screens.Screen(
        ["cutscene", continue_button, "No Input", None, 1])

    battle_button = entitys.Button([(window_sfc.get_width() / 2 - 250,
                                     window_sfc.get_height() / 2 + 50),
                                    (100, 100)])
    train_button = entitys.Button([(window_sfc.get_width() / 2 - 50,
                                    window_sfc.get_height() / 2 + 50),
                                   (100, 100)])
    sleep_button = entitys.Button([(window_sfc.get_width() / 2 + 150,
                                    window_sfc.get_height() / 2 + 50),
                                   (100, 100)])
    room = screens.Room([
        "room", [battle_button, train_button, sleep_button],
        "Battle, Train, or Rest?", [3, 3, 4]
    ])

    speed_button = entitys.Button([(window_sfc.get_width() / 2 - 200,
                                    window_sfc.get_height() / 2 - 50),
                                   (100, 100)])
    health_button = entitys.Button([(window_sfc.get_width() / 2,
                                     window_sfc.get_height() / 2 - 50),
                                    (100, 100)])
    max_health_button = entitys.Button([(window_sfc.get_width() / 2 + 200,
                                         window_sfc.get_height() / 2 - 50),
                                        (100, 100)])
    back_button = entitys.Button([(window_sfc.get_width() / 2 - 550,
                                   window_sfc.get_height() / 2 - 250),
                                  (50, 50)])
    store = screens.Store([
        "store", [speed_button, health_button, max_health_button, back_button],
        "Speed, Health, or Max Health?", [4, 4, 4, 2]
    ])

    arena0 = entitys.Arena([(250), ((window_wid // 2), (window_hgt // 2)), 4,
                            0])
    line0a = entitys.Line([(arena0.location), 0, 180,
                           [(-1.00, -0.50), (-0.30, 0.30), (0.50, 1.00)], [],
                           1, 0])
    goal0 = entitys.Goal([(arena0.location), 10, False, 1], arena0)
    battle0 = screens.Battle(["battle", arena0, [line0a], goal0])

    arena1 = entitys.Arena([(250), ((window_wid // 2), (window_hgt // 2) - 50),
                            4, 1])
    line1a = entitys.Line([(arena1.location), 0, 180,
                           [(-1.00, -0.50), (-0.30, 0.30), (0.50, 1.00)], [],
                           1, 1])
    goal1 = entitys.Goal([(arena1.location), 10, False, 1], arena1)
    battle1 = screens.Battle(["battle", arena1, [line1a], goal1])

    arena2 = entitys.Arena([(250), ((window_wid // 2), (window_hgt // 2) - 50),
                            10, 2])
    line2a = entitys.Line([(arena2.location), 0, 180,
                           [(-1.00, -0.50), (-0.30, 0.30), (0.50, 1.00)], [],
                           1, 1])
    line2b = entitys.Line([(arena2.location), 0, 180,
                           [(-1.00, -0.50), (-0.30, 0.30), (0.50, 1.00)], [],
                           1, -1])
    goal2 = entitys.Goal([(arena2.location), 10, False, 2], arena2)
    battle2 = screens.Battle(["battle", arena2, [line2a, line2b], goal2])

    arena3 = entitys.Arena([(250), ((window_wid // 2), (window_hgt // 2) - 50),
                            15, 4])
    line3a = entitys.Line([(arena3.location), 0, 180,
                           [(-1.00, -0.50), (-0.30, 0.30), (0.50, 1.00)], [],
                           2, 2])
    line3b = entitys.Line([(arena3.location), 0, 360,
                           [(-1.00, -0.70), (-0.50, 0.50), (0.70, 1.00)], [],
                           2, -2])
    goal3 = entitys.Goal([(arena3.location), 10, False, 3], arena3)
    battle3 = screens.Battle(["battle", arena3, [line3a, line3b], goal3])

    arena4 = entitys.Arena([(250), ((window_wid // 2), (window_hgt // 2) - 50),
                            20, 8])
    line4a = entitys.Line([(arena4.location), 0, 120, [(0, 0.4), (0.6, 1.00)],
                           [], 2, 2])
    line4b = entitys.Line([(arena4.location), 120, 240,
                           [(0, 0.4), (0.6, 1.00)], [], 2, 2])
    line4c = entitys.Line([(arena4.location), 240, 360,
                           [(0, 0.4), (0.6, 1.00)], [], 2, 2])
    line4d = entitys.Line([(arena4.location), 0, 120, [(0, 0.4), (0.6, 1.00)],
                           [], 2, -2])
    line4e = entitys.Line([(arena4.location), 120, 240,
                           [(0, 0.4), (0.6, 1.00)], [], 2, -2])
    line4f = entitys.Line([(arena4.location), 240, 360,
                           [(0, 0.4), (0.6, 1.00)], [], 2, -2])
    goal4 = entitys.Goal([(arena4.location), 10, False, 4], arena4)
    battle4 = screens.Battle([
        "battle", arena4, [line4a, line4b, line4c, line4d, line4e, line4f],
        goal4
    ])

    battles = [battle0, battle1, battle2, battle3, battle4]

    # this game object is a circular
    player = entitys.Player([((window_wid / 2), (window_hgt / 2) + 100)])

    game_state = next_state

    # the game loop is a postcondition loop controlled using a Boolean flag
    closed_flag = False
    while not closed_flag:

        #####################################################################################################
        # this is the "inputs" phase of the game loop, where player input is retrieved and stored
        #####################################################################################################
        if (game_state == STATE_TITLE):
            closed_flag = title.quit()
            if (title.check_button()):
                next_state = STATE_ROOM

        elif (game_state == STATE_GAME):

            player.check_moving(battles[player.level].arena)
            closed_flag = battles[player.level].quit()

        elif (game_state == STATE_CUTSCENE):

            if (cutscene.check_button()):
                next_state = cutscene.next_screen

            closed_flag = cutscene.quit()

        elif (game_state == STATE_ROOM):

            if (room.check_buttons(player)):
                next_state = room.next_screen
            closed_flag = room.quit()

        elif (game_state == STATE_STORE):

            if (store.check_buttons(player)):
                next_state = store.next_screen
            closed_flag = room.quit()

        #####################################################################################################
        # this is the "update" phase of the game loop, where the changes to the game world are handled
        #####################################################################################################
        if (game_state == STATE_GAME):

            battles[player.level].update(player)

            #check if the player won
            if (battles[player.level].check(player, cutscene)):
                next_state = STATE_CUTSCENE

        # if the player lost exit loop
        if (game_state == STATE_END):
            closed_flag = True

        #####################################################################################################
        # this is the "render" phase of the game loop, where a representation of the game world is displayed
        #####################################################################################################
        if (game_state == STATE_TITLE):

            title.render(window_sfc)

        elif (game_state == STATE_ROOM):

            room.render(player, window_sfc)

        elif (game_state == STATE_STORE):

            store.render(player, window_sfc)

        elif (game_state == STATE_GAME):

            battles[player.level].render(player, window_sfc)

        elif (game_state == STATE_CUTSCENE):

            cutscene.render(window_sfc)

        # update the display
        pygame.display.update()

        #set the game to the next state
        game_state = next_state

        # enforce the minimum frame rate
        clock.tick(frame_rate)
    # if the player lost re run the game
    if (game_state == STATE_END):
        main()
예제 #5
0
파일: Main.py 프로젝트: Lyxal/hs_program
        except Exception as e:
            file.write(team_backup)
        finally:
            file.close()

    def show_more():
        pass

    #Some quick vars

    article_index = 0
    original_row = ""
    section = ""

    home = screens.Screen("Home", window)

    #Create all the screens.Screens

    heading = tkinter.Label(window,
                            text="Welcome to Jonathan's Car Scruitinizer")
    home.add_item(heading, 0, 1)

    username_label = tkinter.Label(window, text="Username: "******"Password: "******"*")

    host_label = tkinter.Label(window, text="Email Host: ")
예제 #6
0
def back():
        confirm.hide()
        home.show()
        

def update_score():
    global count
    count += 1

print(__name__)
if __name__ == "__main__":           
        #Setup GUI
        bots = list()
        window = tkinter.Tk()
        home = screens.Screen("Home", window)
        
        window.minsize(width=800, height=600)

        heading = tkinter.Label(window, text="Welcome to The SpamBot")
        home.add_item(heading, 0, 1)


        username_label = tkinter.Label(window, text="Username: "******"Password: "******"*")


        host_label = tkinter.Label(window, text="Email Host: ")
예제 #7
0
"""

from scipy.special import gamma, kv
from scipy import linalg
from scipy.interpolate import interp2d
import numpy as np
from numpy import pi

# Numba compiles python code to machine code for faster execution
try:
    import numba
except:
    numba = None    

import screens as scrs
scrn = scrs.Screen()



class PhaseScreen(object):
    """
    A "Phase Screen" for use in AO simulation.  Can be extruded infinitely.
    This represents the phase addition light experiences when passing through atmospheric 
    turbulence. Unlike other phase screen generation techniques that translate a large static 
    screen, this method keeps a small section of phase, and extends it as necessary for as many
    steps as required. This can significantly reduce memory consumption at the expense of more
    processing power required.
    The technique is described in a paper by Assemat and Wilson, 2006 and expanded upon by Fried, 2008.
    It essentially assumes that there are two matrices, "A" and "B",
    that can be used to extend an existing phase screen.
    A single row or column of new phase can be represented by 
예제 #8
0
        s.connect(t)
    except:
        screen._append("NOT CONNECTED!")

    t1 = threading.Thread(
        target=lambda: follow_client(screen, s, addr, window))
    t1.start()
    threads.append(t1)

    window.render()


if __name__ == "__main__":
    window = screens.Window()
    window.onadd = lambda s: set_title(window, s)
    window.add_screen(screens.Screen("Main"))

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind(('0.0.0.0', 1337))
    s.listen(10)

    t = threading.Thread(target=lambda: accept_loop(window, s))
    t.start()

    window.run()
    window.restore_mode()

    running = False
    t.join()
    for t in threads:
예제 #9
0
def new():
    home_screen.hide()
    root.withdraw()
    main_area.show()
    widget_area.show()


dragged_widgets = list()  #of widgets
target_widget = None
target_dndw = None  #Stores the DndWidget form of the target widget (dndw stands for DND Widget)

root = tkinter.Tk()
#############################################
#The home screen
home_screen = screens.Screen("BreezyUI", root)
new_button = tkinter.Button(root, text="New UI", command=new)
home_screen.add_item(new_button, 0, 0)
home_screen.show()

#############################################
#The widgets section
main_area = DndSpace(root, 800, 600)
main_area.top.geometry("+1+60")

widget_area = DndSpace(root, 200, 600)
widget_area.top.geometry("+803+60")

widgets = dict(
)  #A dictionary to store all the widget objects which the clones will
#come from
예제 #10
0
# KDI for Wave Optics Simulation (Branched Flow Honors Thesis 2021)
# i.e., solving the Kirchhoff Diffraction Integral using Split Step FFT Methods
# Author: Jakob Faber

from imports import *
import sources as srcs
import screens as scrs
from numba import jit

scrkol = scrs.Screen()
s = srcs.Source()


class Propagator():
    def __init__(self,
                 rf=1,
                 ds=0.01,
                 alpha=5 / 3,
                 ar=1,
                 psi=0,
                 nscreen=2,
                 PropDist=10e3,
                 dlam=0.25,
                 wavelen=1,
                 inner=0.001,
                 ns=256,
                 nf=256,
                 nx=None,
                 ny=None,
                 dx=None,
                 dy=None,
예제 #11
0
main.add_item(editor, 7, 40)
main.add_item(file_display, 75, 655)
main.add_item(count_display, 575, 655)
main.add_item(save_display, 75, 675)
main.add_item(changes_display, 575, 675)

heading = tkinter.Label(window, text="Add A Link", font=("Helvetica", 15))

text_label = tkinter.Label(window, text="Display Text: ")
text = tkinter.Entry(window, width=100)

link_label = tkinter.Label(window, text="Address: ")
link_box = tkinter.Entry(window, width=100)

submit = tkinter.Button(window, text="Submit", command=confirm_link)

popup = screens.Screen("Add A Link", window)
popup.add_item(heading, 0, 0)
popup.add_item(text_label, 1, 0)
popup.add_item(text, 1, 1)
popup.add_item(link_label, 2, 0)
popup.add_item(link_box, 2, 1)
popup.add_item(submit, 3, 1)

editor.config(width=168)
editor.config(height=38)

main.show()
window.mainloop()