def main(argv):
    r1 = int(argv[1])
    g1 = int(argv[2])
    b1 = int(argv[3])

    c1 = color.Color(r1, g1, b1)

    r2 = int(argv[4])
    g2 = int(argv[5])
    b2 = int(argv[6])

    c2 = color.Color(r2, g2, b2)
    stddraw.createWindow()
    stddraw.setPenColor(c1)
    stddraw.filledSquare(.25, .5, .2)

    stddraw.setPenColor(c2)
    stddraw.filledSquare(.25, .5, .1)

    stddraw.setPenColor(c2)
    stddraw.filledSquare(.75, .5, .2)

    stddraw.setPenColor(c1)
    stddraw.filledSquare(.75, .5, .1)
    stddraw.show()
    stddraw.wait()
 def _loadFromJpgFile(self, f):
     """
     Change 'self' by reading from the JPG file whose name is 'f'.
     """
     try:
         from PIL import Image
         image = Image.open(f)
         maxW, maxH = image.size
         self._photoImage = \
             Tkinter.PhotoImage(width=maxW, height=maxH)
         self._buffer = \
             stdarray.create2D(maxW, maxH, str(color.BLACK))
         for w in range(maxW):
             for h in range(maxH):
                 r, g, b = image.getpixel((w, h))
                 c = color.Color(r, g, b)
                 self._buffer[w][h] = str(c)
         self._isDirty = True
     except ImportError:
         import pygame
         surface = pygame.image.load(f)
         maxW = surface.get_width()
         maxH = surface.get_height()
         self._photoImage = \
             Tkinter.PhotoImage(width=maxW, height=maxH)
         self._buffer = \
             stdarray.create2D(maxW, maxH, str(color.BLACK))
         for w in range(maxW):
             for h in range(maxH):
                 r, g, b, a = tuple(surface.get_at((w, h)))
                 c = color.Color(r, g, b)
                 self._buffer[w][h] = str(c)
         self._isDirty = True
def test_two_colors(c1, c2):
    '''
    Feed in the rgb values of color one,
    then the rgb values of color two (as lists).
    Adds these two together.
    '''
    color1 = color.Color(c1[0], c1[1], c1[2])
    color2 = color.Color(c2[0], c2[1], c2[2])
    new_color = color1 + color2

    return (check_vals(new_color.r, (color1.r + color2.r) / 2)
            and check_vals(new_color.g, (color1.g + color2.g) / 2)
            and check_vals(new_color.b, (color1.b + color2.b) / 2))
Exemple #4
0
def show_time(t):
    col_text_bg = color.Color(0, 0, 255)
    col_text_fg = color.Color(255, 255, 255)
    col_time_bg = color.Color(0, 128, 255)
    col_time_fg = color.Color(255, 255, 255)

    t_min, t_sec = int(t / 60), int(t % 60)
    t_msg = "{:02d} : {:02d}".format(t_min, t_sec)

    with display.open() as disp:
        disp.clear(col_text_bg)
        disp.print("alarm", fg=col_text_fg, bg=col_text_bg, posx=47)
        disp.rect(0, 20, 160, 60, col=col_time_bg)
        disp.print(t_msg, fg=col_time_fg, bg=col_time_bg, posx=35, posy=30)
        disp.update()
Exemple #5
0
    def __init__(self, title, width, height):
        self.Title = title
        self.Height = height
        self.Width = width
        self.Screen = pygame.display.set_mode((self.Width, self.Height))

        #This is to initialize the framerate (fps)
        self.Clock = pygame.time.Clock()

        #This color is a refrence to the color object, in there all different colors are defined
        self.Color = clr.Color()
        self.DefaultFont = pygame.font.SysFont(None, 30)

        #Initialize text messages
        self.StartText = Text.Text(self.Color.Black, self.DefaultFont,
                                   "Welcom to my pygame template!!!")

        #Initialize the soundprovider
        self.BackgroundMusic = sp.SoundProvider(
            "9th_Symphony_Finale_by_Beethoven.mp3")
        #Set the background music to play
        self.BackgroundMusic.Play(5)

        #Create all game characters here
        self.Player1 = c.Component(c.Position(400, 100), "enemy.png")

        #Create a button
        self.ExitButton = button.Button(
            300, 250, 50, 200, self.Color.Red,
            Text.Text(self.Color.Black, self.DefaultFont, "Exit"),
            lambda: sys.exit())
        self.StartButton = button.Button(
            600, 250, 50, 200, self.Color.Green,
            Text.Text(self.Color.Black, self.DefaultFont, "Start"))
Exemple #6
0
    def test_reflection_color(self):
        scene = scene_one.scene()
        input = {
            "scene":
            scene,
            "thing":
            scene.things[1],
            "pos":
            Vector(x=0.9682536088805778,
                   y=1.120726634856072,
                   z=-0.46888359583591654),
            "normal":
            Vector(x=0.9682536088805801,
                   y=0.12072663485607234,
                   z=-0.21888359583591707),
            "rd":
            Vector(x=0.017881548532950597,
                   y=-0.12328111142237405,
                   z=-0.9922106720795377),
            "depth":
            0
        }
        res = get_reflection_color(**input)

        output = color.Color(r=0.15929183224593932,
                             g=0.1756515946612255,
                             b=0.1870300937260152)

        self.assertSequenceEqual(res, output)
Exemple #7
0
    def color_in_loop(self, progress, blended=True):
        """
        This returns a contiguous loop of colors where each one
        blend into the next without a hard edge. 0.0 and 1.0 are
        the same color.

        Think rainbow that is a repeated pattern with no discernible
        boundary.
        """
        progress = math.modf(progress)[0]

        pos = progress * self.num_colors
        low_ix = int(math.floor(pos))
        high_ix = low_ix + 1

        # High might need to wrap
        if high_ix >= self.num_colors:
            high_ix = 0

        interval_distance = pos - low_ix

        if blended:
            return color.Color(tween.hsvLinear(self.colors[low_ix], self.colors[high_ix], interval_distance))
        else:
            return self.colors[low_ix]
Exemple #8
0
    def color_in_ramp(self, progress, blended=True):
        """
        A color from the palette without wrapping smoothly back to the
        beginning. Color 0.0 is the first, and color 1.0 is the last,
        but these will not be the same color. Color 1.01 will be the
        same as color 0.01 though.
        """

        # Special case this because it will otherwise get eaten
        # by the modf (wrapped to 0). This effectively means that we are
        # fudging the very first interval slightly so that the 1.0
        # value is the "pure" final answer for the 0 to 1 interval
        # but in all other integer cases after 1 the value will be the
        # 0 value not the 1 value. This fudging makes life make more
        # sense IMHO, and is likely only hit when other code is
        # special case explicitly trying to get the 1.0 color.
        if progress == 1.0:
            return self.colors[self.num_colors-1]

        progress = math.modf(progress)[0]

        pos = progress * (self.num_colors - 1)
        low_ix = int(math.floor(pos))
        high_ix = low_ix + 1

        # High might need to wrap
        if high_ix >= self.num_colors:
            high_ix = 0

        interval_distance = pos - low_ix

        if blended:
            return color.Color(tween.hsvLinear(self.colors[low_ix], self.colors[high_ix], interval_distance))
        else:
            return self.colors[low_ix]
Exemple #9
0
    def __init__(self, config, layout=None):
        Gtk.TextBuffer.__init__(self)
        self.config = config
        self.layout = layout
        self.last_prefix = None
        self.last_message_type = None
        self.longest_prefix = 0
        self.indent_tag_list = []
        self.d_previous = datetime.datetime.fromtimestamp(0)

        # We need the color class that convert formatting codes in network
        # data to codes that the parser functions in this class can handle
        self._color = color.Color(config_module.color_options(), False)

        # Text tags used for formatting
        self.time_tag = self.create_tag(justification=Gtk.Justification.RIGHT,
                                        weight=Pango.Weight.BOLD)
        bold_tag = self.create_tag(weight=Pango.Weight.BOLD)
        underline_tag = self.create_tag(underline=Pango.Underline.SINGLE)
        italic_tag = self.create_tag(style=Pango.Style.ITALIC)
        reverse_tag = self.create_tag()  # reverse video is not implemented
        self.attr_tag = {
            "*": bold_tag,
            "_": underline_tag,
            "/": italic_tag,
            "!": reverse_tag
        }
        self.url_tag = self.create_tag(underline=Pango.Underline.SINGLE)
Exemple #10
0
    def update_at_progress(self, progress, new_loop, loop_instance):

        units = geom.by_faces

        for ix, unit in enumerate(units):
            distance = 0
            l = len(unit) - 1

            for jx, cell_id in enumerate(unit):
                if self.cm.modifiers[1]:
                    # Reverse
                    distance = (float(l-jx) / float(len(unit))) + progress
                else:
                    distance = (float(jx) / float(len(unit))) + progress

                # Clamp
                if distance > 1.0:
                    distance = distance - 1.0
                if distance < 0.0:
                    distance = distance + 1.0

                # Color
                if self.cm.modifiers[0]:
                    clr = color.HSVryb(distance, 1.0, 1.0)
                elif self.cm.modifiers[1]:
                    clr = color.Color(tween.hsvLinear(self.cm.chosen_colors[0], self.cm.chosen_colors[1], distance))
                else:
                    clr = color.HSV(distance, 1.0, 1.0)

                # Set the one cell
                self.ss.party.set_cell(cell_id, clr)
Exemple #11
0
        def cylon(self):
            red = 0
            for i in range(0, self.__strip.numPixels()):
                self.__strip.setPixelColor(i, color.Color(red, 0, 0))
                red += 1

            self.__strip.show()
Exemple #12
0
    def __init__(self, title, width, height):
        self.Title = title
        self.Height = height
        self.Width = width
        self.Screen = pygame.display.set_mode((self.Width, self.Height))

        #This is to initialize the framerate (fps)
        self.Clock = pygame.time.Clock()

        #This color is a refrence to the color object, in there all different colors are defined
        self.Color = clr.Color()
        self.DefaultFont = pygame.font.SysFont(None,30)

        #Initialize text messages
        self.InfoText = Text.Text(self.Color.Red, self.DefaultFont, "COUNT TO 10 | Click the button to increment the counter and finish the game!!!")

        
        #Create a button
        self.CountButton = button.Button(100,250, 50,200, self.Color.Yellow, Text.Text(self.Color.Black, self.DefaultFont, "Click me!"))
       
        #Initialize the counter to 0
        self.Counter = 0

        #Store the counter in a text object
        self.CounterText = Text.Text(self.Color.Black, self.DefaultFont, str(self.Counter))
Exemple #13
0
    def __init__(self, title, width, height):
        #The basic parameters wich make up the game
        self.Title = title
        self.Height = height
        self.Width = width
        self.Screen = pygame.display.set_mode((self.Width, self.Height))

        #This is to initialize the framerate (fps)
        self.Clock = pygame.time.Clock()

        #This color is a refrence to the color object, in there all different colors are defined
        self.Color = clr.Color()
        self.DefaultFont = pygame.font.SysFont(None, 30)

        self.InfoText = Text.Text(
            self.Color.Black, self.DefaultFont,
            "Score 3 points to go to the next level, press space to fly!")

        #Create all game characters here
        self.Player1 = c.Component(c.Position(400, 250), "enemy.png")

        #Empty list of enemies, this will be filled during the game
        #This is a special kind of list called an array, each element in the array has an unique Index
        #indeces start from 0, by calling Enemies[3] you call enemy in position number 3
        #!!!!BECAREFULL WITH THE BOUNDS: When the index does not exist you will get an error, always check if the IndexError
        #exists before calling it.
        self.Enemies = []
Exemple #14
0
def llamarEjercicio(ejercicio, usuario):
    """Este módulo se dedica a llamar al script del ejercicio seleccionado"""

    #SE INSTANCIA UN OBJETO COLOR PARA DAR FORMATO AL TEXTO
    c = color.Color()

    #SE INSTANCIA UN OBJETO AVANCE_USUARIO PARA GUARDAR EL AVANCE
    avance = Avance_Usuario()
    #SE OBTIENE EL NOMBRE DEL EJERCICIO
    nombreEjercicio = ejercicio.nombre

    #SE MANDA A LLAMAR AL SCRIPT DEL EJERCICIO
    resultado = eval(f"ejercicios.{nombreEjercicio}.vistaEjercicio(usuario)")

    #SE ACTUALIZAN LAS ESTADÍSTICAS PARA EL USUARIO
    avance.actualizarAvance(ejercicio, usuario, resultado[1])

    #SI EL RESULTADO ESTÁ MAL SE MANDA A LLAMAR EL MODULO DE AYUDA
    if resultado[1] == False:
        mostrarAyuda(ejercicio, usuario)
    else:
        print(c.BOLD + f'\n\n\t¡Bien hecho, tu resultado es ' + c.GREEN +
              'CORRECTO' + c.END + c.BOLD + '! \n\n' + c.END)
        input(c.BOLD + "Da enter para continuar..." + c.END)

    return resultado
Exemple #15
0
    def __init__(self, title, width, height):
        self.Title = title
        self.Height = height
        self.Width = width
        self.Screen = pygame.display.set_mode((self.Width, self.Height))

        #This is to initialize the framerate (fps)
        self.Clock = pygame.time.Clock()

        #This color is a refrence to the color object, in there all different colors are defined
        self.Color = clr.Color()
        self.DefaultFont = pygame.font.SysFont(None, 30)

        #Initialize text messages
        self.StartText = Text.Text(
            self.Color.Black, self.DefaultFont,
            "Make the player move on the screen, up, down, left and right!")
        self.NextLine = Text.Text(
            self.Color.Black, self.DefaultFont,
            "Why do the same thing over and over again when it allready exists!!!"
        )

        #Create all game characters here
        self.Player1 = c.Component(c.Position(400, 100), "enemy.png")
        self.Apple = c.Component(c.Position(0, 0), "apple.png")

        self.AppleCounter = 0
        self.Score = Text.Text(self.Color.Black, self.DefaultFont,
                               "Apple Counter: " + str(self.AppleCounter))
Exemple #16
0
def seleccionTipoEjercicio(usuario):
    """Muestra pantalla donde el usuario elige el tipo de ejercicios que quiere
    resolver, así como el avance"""

    #SE INSTANCIA UN OBJETO COLOR PARA DAR FORMATO AL TEXTO
    c = color.Color()
    validacion = True

    while validacion:

        subprocess.call('clear')
        logo = logoUAM.printLogo()
        print(logo)
        #SE LISTAN LOS TIPOS DE EJERCICIOS DISPONIBLES
        print(c.BOLD + f'¡Hola {usuario.username.upper()}!' + c.END + ',')
        print('A continuación puedes elegir el tipo de ejercicio a realizar.')
        print("""
            1. Prácticar comandos de Docker
            2. Troubleshooting en Docker
            3. Retos de comandos en Docker
            4. Salir 
        """)

        opcion = input(c.BOLD + 'Tu opción: ' + c.END)

        try:
            subprocess.call('clear')

            if opcion == '1':
                validacion = False
                #LANZA LA VISTA PARA PRACTICAR COMANDOS
                seleccionEjercicio(usuario, "practica")
                seleccionTipoEjercicio(usuario)

            elif opcion == '2':
                validacion = False
                #LANZA LA VISTA PARA PRACTICAR TROUBLESHOOTING
                seleccionEjercicio(usuario, "problema")
                seleccionTipoEjercicio(usuario)

            elif opcion == '3':
                validacion = False
                #LANZA LA VISTA PARA LOS RETOS DE COMANDOS
                seleccionEjercicio(usuario, "reto")
                seleccionTipoEjercicio(usuario)

            elif opcion == '4':
                #SALE DE LA APLICACIÓN
                print(c.BOLD + c.YELLOW +
                      f'\n¡Hasta luego, {usuario.username.upper()}!\n' + c.END)
                break

            else:
                #SE ATRAPA EL ERROR EN CASO DE QUE INTRODUZCAN OTRA OPCIÓN
                raise ValueError('OpcionInvalida')

        except ValueError:
            print('\n¡Opción inválida! :(, intenta otra vez.\n')
            continue
Exemple #17
0
def loop():
    while True:
        pull()

        num = 0
        for bit in make():
            num |= 1 << bit

        for thresh, red, green in [(16, 255, 0), (32, 220, 20), (64, 200, 50),
                                   (128, 180, 75), (255, 100, 150)]:
            if num < thresh:
                col = color.Color(red, green, 0)
                break
        else:
            col = color.Color(0, 255, 0)

        SENDER.send(col)
Exemple #18
0
    def test_darken(self):
        """Test media.darken."""

        c = color.Color(100, 100, 100)
        media.darken(c)
        self.assert_(c.get_red() == 70)
        self.assert_(c.get_green() == 70)
        self.assert_(c.get_blue() == 70)
Exemple #19
0
    def get_pixel_color(self, coordinates):
        """Return the color.Color of the pixel at the given coordinates

        Arguments:
        coordinates -- coordinates of the pixel as a point.Point
        """

        return color.Color(*self.pixels[coordinates.coordinates])
Exemple #20
0
def main():
    stddraw.createWindow()
    stddraw.setXscale(0, 15)
    stddraw.setYscale(0, 15)
    for i in range(16):
        for j in range(16):
            #val = i + 16*j
            val = 8 * i + 8 * j
            #c1 = color.Color(0, 0, 255-val)
            c1 = color.Color(255 - val, 255 - val, 255)
            c2 = color.Color(val, val, val)
            stddraw.setPenColor(c1)
            stddraw.filledSquare(i, j, 0.5)
            stddraw.setPenColor(c2)
            stddraw.filledSquare(i, j, 0.25)
            stddraw.show()
    stddraw.wait()
Exemple #21
0
    def draw(self, disp):
        for i in range(LINE_AMOUNT):
            if not self._lines[i].update_check():
                self._lines[i] = Line()

            for p in self._lines[i]:
                disp.pixel(p[0][0],
                           p[0][1],
                           col=color.Color(p[1][0], p[1][1], p[1][2]))
def generatecomplementary(colorobj, amount=1):
    """Generates a list of complementary colors. Finds the proper angle to add to the colorobj hue based off the amount. Then creates color list based of new hues.
    """
    startHSV = colorobj.getHSV()
    angle = 360 / (amount + 1)
    huelist = [startHSV[0]]
    rgblist = []
    for colorint in range(amount):
        testangle = huelist[colorint] + angle
        if testangle > 360:
            testangle -= 360
        huelist.append(testangle)

    for hue in huelist:
        testlist = [hue, startHSV[1], startHSV[2]]
        testcolor = color.Color(testlist)
        rgblist.append(color.Color(testlist))
    return rgblist
Exemple #23
0
 def get(self, w, h):
     """
     Return the color of 'self' at location ['w', 'h']
     """
     colorStr = self._buffer[w][h]
     r = int(colorStr[1:3], 16)  # Red component
     g = int(colorStr[3:5], 16)  # Green component
     b = int(colorStr[5:], 16)   # Blue component
     return color.Color(r, g, b)
Exemple #24
0
    def draw_entry(self, item, index, offset):
        if item[1] == personal_state.NO_CONTACT:
            bg = color.RED
            fg = color.WHITE
        elif item[1] == personal_state.CHAOS:
            bg = color.CHAOSBLUE
            fg = color.CHAOSBLUE_DARK
        elif item[1] == personal_state.COMMUNICATION:
            bg = color.COMMYELLOW
            fg = color.COMMYELLOW_DARK
        elif item[1] == personal_state.CAMP:
            bg = color.CAMPGREEN
            fg = color.CAMPGREEN_DARK
        else:
            bg = color.Color(100, 100, 100)
            fg = color.Color(200, 200, 200)

        self.disp.print(" " + str(item[0]) + " " * 9, posy=offset, fg=fg, bg=bg)
Exemple #25
0
 def process_color(self, critter):
     """
     Processes the colors for critters according to health remaining (Point Caches default to 50),
     in order to fade colors as their health decreases.
     """
     health = self.model.critter_healths.get(critter, 50)
     results = []
     for value in self.model.model_functions['get_color'](self.model, critter):
         results += [255 - (health * (255 - value) // 50)]
     return color.Color(*results)
Exemple #26
0
def seleccionEjercicio(usuario, tipo):
    """Muestra los ejercicios disponibles dependiendo el tipo de ejercicio"""

    #SE INSTANCIA UN OBJETO COLOR PARA DAR FORMATO AL TEXTO
    c = color.Color()

    logo = logoUAM.printLogo()
    print(logo)
    avance = Avance_Usuario()

    #SE INSTANCIA UN OBJETO EJERCICIO
    listaEjercicios = Ejercicio()
    #SE RECUPERA LA LISTA DE EJERCICIOS EN LA BD DE ACUERDO AL TIPO DE EJERCICIO
    listaEjercicios = listaEjercicios.recuperarEjercicios(tipo)

    print('De acuerdo ' + c.BOLD + f'{usuario.username.upper()}' + c.END +
          ', vamos a realizar' + ' algunos ejercicios en el servidor Docker.')
    print('\nElige de la siguiente lista cuál quieres hacer:\n')

    #MUESTRA LA LISTA DE EJERCICIOS
    for ejercicio in enumerate(listaEjercicios, 1):
        listAvance = avance.recuperarAvance(ejercicio[1], usuario)
        print(f"\t{ejercicio[0]}. {ejercicio[1].descripcion}".ljust(40),
              end=" ")

        try:
            resuelto = listAvance.resuelto
            intentos = listAvance.intento
            #print(f"Intentos: {listAvance.intento}\tResuelto: {listAvance.resuelto}".rjust(20))
        except:
            resuelto = 'No'
            intentos = '0'

            #print("Intentos: 0\tResuelto: No".rjust(20))
        if resuelto == True:
            resuelto = 'Sí'
        elif resuelto == False:
            resuelto = 'No'

        print(f"Intentos: {intentos}\tResuelto: {resuelto}".rjust(20))

    print(f"\t{len(listaEjercicios)+1}. Regresar al menú principal")

    #SE ESPERA LA ELECCIÓN DEL USUARIO
    opcion = int(input(c.BOLD + "\nTu opción: " + c.END))

    if opcion >= 1 and opcion <= len(listaEjercicios):
        #SE OBTIENE EL EJERCICIO Y EL NOMBRE
        ejercicio = listaEjercicios[opcion - 1]

        llamarEjercicio(ejercicio, usuario)
    else:
        pass

    return True
Exemple #27
0
    def visualize_q_table(self, width):

        qt = sorted(self.q_table.items())
        GRID_SIZE_X = width / len(self.actions)
        GRID_SIZE_Y = width / len(qt)

        for i in range(0, len(self.q_table.items())):

            for j in range(0, len(self.actions)):
                #print(str(qt[i][1][j]) + ' ',end='')
                current_val = (qt[i][1][j])
                sigmoid = 1 / (1 + math.exp(-current_val)
                               )  #get a range between 0 and 1
                state_name = qt[i][0] + " - " + str(round(qt[i][1][j], 2))
                if current_val < 0:
                    new_color = color.Color(int(sigmoid * 255), 0, 0)
                elif current_val == 0.0:
                    new_color = color.Color(0, 0, 0)
                else:
                    new_color = color.Color(0, int(sigmoid * 255), 0)
                #stddraw.setPenColor(color.BLACK)
                #stddraw.text((GRID_SIZE_X * i) + (GRID_SIZE/2),(GRID_SIZE * j) + (GRID_SIZE / 2), state_name)

                stddraw.setPenColor(new_color)
                stddraw.filledRectangle(
                    (GRID_SIZE_X * j), width - (GRID_SIZE_Y * i) - GRID_SIZE_Y,
                    GRID_SIZE_X, GRID_SIZE_Y)
                stddraw.setPenColor(color.WHITE)
                stddraw.text((GRID_SIZE_X * j) + (GRID_SIZE_X / 2),
                             width - (GRID_SIZE_Y * i) - GRID_SIZE_Y +
                             (GRID_SIZE_Y / 2), state_name)

        stddraw.setPenColor(color.BLACK)
        #gridlines
        for i in range(1, len(self.q_table.items())):
            stddraw.filledRectangle(0, GRID_SIZE_Y * i, width, 0)

        for i in range(1, len(self.actions)):
            stddraw.filledRectangle(GRID_SIZE_X * i, 0, 0, width)

        stddraw.show(0)
Exemple #28
0
def vistaEjercicio(usuario):
    """Función que crea el Nivel 3 de retos"""

    #SE INSTANCIA UN OBJETO COLOR PARA DAR FORMATO AL TEXTO
    c = color.Color()

    #SE LIMPIA LA PANTALLA
    sp.run('clear')
    logo = logoUAM.printLogo()
    print(logo)

    sentencia = """
    A continuación, intenta realizar lo siguiente:
    
        ELIMINAR la imagen de ubuntu y TODOS los contenedores con UN sólo comando.
    
    IMPORTANTE: Una vez que aparezca el prompt, solo podrás introducir una línea, 
    por lo que introduce tu respuesta y da enter cuando estés seguro de que está
    correcta. Al dar enter se comenzará con la evaluación del ejercicio.
    """

    print(sentencia)

    input(c.BOLD + 'Da enter para comenzar...' + c.END)

    #SE COMIENZA A PREPARAR EL EJERCICIO
    print('\nPreparando tu escenario, espera a que aparezca el prompt.\n')

    prepararEjercicio()

    #SE CARGAN LOS CONTENEDORES PARA EL ESCENARIO
    for i in range(2):
        sp.run(['docker', 'run', '-dit', 'ubuntu'], capture_output=True)

    #SE MUESTRAN LOS CONTENEDORES ACTIVOS
    print('\n* Contenedores actualmente activos')
    sp.run(['docker', 'ps', '-a'], capture_output=False, encoding='utf-8')

    #SE MUESTRAN LAS IMAGENES CARGADAS
    print('\n* Imágenes actualmente cargadas')
    sp.run(['docker', 'images'])

    cmd = input(c.BOLD + '\n\nTuPrompt$ ' + c.END)
    #SE INTRODUCE EL COMANDO DEL USUARIO
    sp.run(cmd, capture_output=False, encoding='utf-8', shell=True)

    #SE MANDA A EVALUAR EL EJERCICIO
    resultado = evaluarEjercicio()

    resultadoEjercicio = [usuario, resultado]
    sleep(2)

    return resultadoEjercicio
Exemple #29
0
    def __init__(self, title, width, height):
        self.Title = title
        self.Height = height
        self.Width = width
        self.Screen = pygame.display.set_mode((self.Width, self.Height))

        self.DefaultFont = pygame.font.SysFont(None, 30)

        #This color is a refrence to the color object, in there all different colors are defined
        self.Color = clr.Color()

        #Create all game characters here
        self.Player1 = c.Component(c.Position(200, 250), "giphy.gif")
Exemple #30
0
def main():
    global color
    color = c.Color()
    args = setArguments()
    if (args.o == None):
        print(parser.print_help())
        exit(0)

    displayLogo()
    words = combineWordlist(args.files)
    generate(words, args.o)
    if (args.compress == '1'):
        compress(args.o)