예제 #1
0
class CreatePy:
    state = 'wait'

    def __init__(self, dim, pos):
        self.cadre = Cadre(dim, pos, C.WHITE)
        self.text_create = TextBox(DIM_INPNAME, (pos[0] + 40, pos[1] + 100),
                                   C.WHITE,
                                   'Create a python file?',
                                   font=Font.f(30))
        self.button_yes = Button(DIM_BDONE, (pos[0] + 40, pos[1] + 180),
                                 C.LIGHT_GREEN,
                                 'Yes',
                                 font=Font.f(30))
        self.button_no = Button(DIM_BDONE, (pos[0] + 200, pos[1] + 180),
                                C.LIGHT_RED,
                                'No',
                                font=Font.f(30))

    def display(self):
        self.cadre.display()
        self.button_yes.display()
        self.button_no.display()
        self.text_create.display()

    def react_events(self, events, pressed):
        if self.button_yes.pushed(events):
            self.state = 'yes'
        elif self.button_no.pushed(events):
            self.state = 'no'
예제 #2
0
 def __init__(self, dim, pos):
     self.cadre = Cadre(dim, pos, C.WHITE)
     self.text_create = TextBox(DIM_INPNAME, (pos[0] + 40, pos[1] + 100),
                                C.WHITE,
                                'Create a python file?',
                                font=Font.f(30))
     self.button_yes = Button(DIM_BDONE, (pos[0] + 40, pos[1] + 180),
                              C.LIGHT_GREEN,
                              'Yes',
                              font=Font.f(30))
     self.button_no = Button(DIM_BDONE, (pos[0] + 200, pos[1] + 180),
                             C.LIGHT_RED,
                             'No',
                             font=Font.f(30))
예제 #3
0
 def __init__(self, pos):
     self.dim = (800, 600)
     self.pos = list(pos)
     self.cadre = Cadre(self.dim, pos, C.WHITE, set_transparent=True)
     self.text_newwindow = TextBox((self.dim[0], 80), pos, C.WHITE,
                                   'New Window')
     self.text_dim = TextBox((400, 60), (pos[0] + 200, pos[1] + 150),
                             C.WHITE,
                             "Enter window dimension",
                             font=Font.f(30))
     self.input_x = InputText(DIM_INPDIM, (pos[0] + 210, pos[1] + 250),
                              C.WHITE,
                              text='1000',
                              limit=4)
     self.input_y = InputText(DIM_INPDIM, (pos[0] + 410, pos[1] + 250),
                              C.WHITE,
                              text='1000',
                              limit=4)
     self.text_name = TextBox((150, 60), (pos[0] + 100, pos[1] + 350),
                              C.WHITE,
                              'File name:',
                              font=Font.f(30))
     self.input_name = InputText(DIM_INPNAME, (pos[0] + 300, pos[1] + 350),
                                 C.WHITE)
     self.button_done = Button(DIM_BDONE, (pos[0] + 650, pos[1] + 500),
                               C.LIGHT_BLUE,
                               'Done',
                               font=Font.f(30))
예제 #4
0
class NewWindow:
    def __init__(self, pos):
        self.dim = (800, 600)
        self.pos = list(pos)
        self.cadre = Cadre(self.dim, pos, C.WHITE, set_transparent=True)
        self.text_newwindow = TextBox((self.dim[0], 80), pos, C.WHITE,
                                      'New Window')
        self.text_dim = TextBox((400, 60), (pos[0] + 200, pos[1] + 150),
                                C.WHITE,
                                "Enter window dimension",
                                font=Font.f(30))
        self.input_x = InputText(DIM_INPDIM, (pos[0] + 210, pos[1] + 250),
                                 C.WHITE,
                                 text='1000',
                                 limit=4)
        self.input_y = InputText(DIM_INPDIM, (pos[0] + 410, pos[1] + 250),
                                 C.WHITE,
                                 text='1000',
                                 limit=4)
        self.text_name = TextBox((150, 60), (pos[0] + 100, pos[1] + 350),
                                 C.WHITE,
                                 'File name:',
                                 font=Font.f(30))
        self.input_name = InputText(DIM_INPNAME, (pos[0] + 300, pos[1] + 350),
                                    C.WHITE)
        self.button_done = Button(DIM_BDONE, (pos[0] + 650, pos[1] + 500),
                                  C.LIGHT_BLUE,
                                  'Done',
                                  font=Font.f(30))

    def react_events(self, events, pressed):
        self.input_x.run(events, pressed)
        self.input_y.run(events, pressed)
        self.input_name.run(events, pressed)

    def create_windows(self):
        try:
            x = int(self.input_x.content)
            y = int(self.input_y.content)
            if x > 3000 or y > 1600:
                print('Wrong coord')
                return
            name = self.input_name.content
        except:
            print('Wrong coord')
            return
        new_win = Window(name, (x, y))
        return new_win

    def display(self):
        self.cadre.display()
        self.text_newwindow.display()
        self.text_dim.display()
        self.input_x.display()
        self.input_y.display()
        self.text_name.display()
        self.input_name.display()
        self.button_done.display()
예제 #5
0
 def __init__(self, ChessGame):
     self.ChessGame = ChessGame
     self.cadre = Cadre((600, 1600), POS_MENU)
     self.text_turn = TextBox((400, 80),
                              (POS_MENU[0] + 50, POS_MENU[1] + 50),
                              text="Turn white",
                              font=Font.f(50),
                              centered=False)
     self.text_poss_moves = TextBox((600, 60),
                                    (POS_MENU[0] + 50, POS_MENU[1] + 210),
                                    text="Possible moves: 20",
                                    font=Font.f(50),
                                    centered=False)
     self.text_end = TextBox((450, 120),
                             (POS_MENU[0] + 50, POS_MENU[1] + 360),
                             font=Font.f(50))
     self.button_start = Button((450, 100),
                                (POS_MENU[0] + 50, POS_MENU[1] + 590),
                                C.LIGHT_GREEN,
                                text="Start new  game",
                                font=Font.f(50))
     self.state = 'start'
예제 #6
0
class Menu:
    default_text_turn = "Turn white"
    default_text_poss_moves = "Possible moves: 20"

    def __init__(self, ChessGame):
        self.ChessGame = ChessGame
        self.cadre = Cadre((600, 1600), POS_MENU)
        self.text_turn = TextBox((400, 80),
                                 (POS_MENU[0] + 50, POS_MENU[1] + 50),
                                 text="Turn white",
                                 font=Font.f(50),
                                 centered=False)
        self.text_poss_moves = TextBox((600, 60),
                                       (POS_MENU[0] + 50, POS_MENU[1] + 210),
                                       text="Possible moves: 20",
                                       font=Font.f(50),
                                       centered=False)
        self.text_end = TextBox((450, 120),
                                (POS_MENU[0] + 50, POS_MENU[1] + 360),
                                font=Font.f(50))
        self.button_start = Button((450, 100),
                                   (POS_MENU[0] + 50, POS_MENU[1] + 590),
                                   C.LIGHT_GREEN,
                                   text="Start new  game",
                                   font=Font.f(50))
        self.state = 'start'

    def display(self):
        self.cadre.display()
        self.text_turn.display()
        self.text_poss_moves.display()
        if self.state == 'start':
            self.text_end.display()
            self.button_start.display()

    def react_events(self, events, pressed):
        if self.state == 'start':
            if self.button_start.pushed(events):
                self.state = 'run'
                self.ChessGame.set_players()
                # re-add pieces
                Interface.add_resizable_objs(
                    self.ChessGame.players['white'].pieces)
                Interface.add_resizable_objs(
                    self.ChessGame.players['black'].pieces)

    def __call__(self, turn, poss_moves):
        '''Call in ChessGame.check_end_game'''
        self.text_turn.set_text(f'Turn: {turn}')
        self.text_poss_moves.set_text(f'Possible moves: {poss_moves}')

    def end_game(self, winner):
        self.text_end.set_text(f'Winner {winner}')
        self.text_turn.set_text(self.default_text_turn)
        self.text_poss_moves.set_text(self.default_text_poss_moves)
        self.state = 'start'
예제 #7
0
E = lambda x: int(x * Dimension.f)
dim = Dimension((E(3000), E(1600)))

inter = Interface()

DIM_SCREEN = (E(800), E(400))
screen = pygame.display.set_mode(DIM_SCREEN)
screen.fill(C.WHITE)
pygame.display.set_caption('Update')

set_screen(screen)

DIM_TC = (E(400), E(60))

text_conn = TextBox(DIM_TC,
                    C.WHITE, (E(200), E(100)),
                    'Connecting...',
                    font=Font.f30)

text_fail_conn = TextBox(DIM_TC,
                         C.WHITE, (E(200), E(100)),
                         'Connection failed',
                         font=Font.f30)

text_search = TextBox(DIM_TC,
                      C.WHITE, (E(200), E(100)),
                      'Looking for update...',
                      font=Font.f30)

text_finish = TextBox(DIM_TC,
                      C.WHITE, (E(200), E(100)),
                      'Game up to date.',
예제 #8
0
class Settings:
    activate = False
    text_name = TextBox((150, DIM_Y), (POS_X, 200),
                        C.LIGHT_BLUE,
                        'Name:',
                        font=Font.f(25))
    input_name = InputText((250, DIM_Y), (POS_X + 150, 200),
                           C.WHITE,
                           font=Font.f(25),
                           limit=20)
    text_coord = TextBox((100, DIM_Y), (POS_X, 260),
                         C.LIGHT_BLUE,
                         'pos',
                         font=Font.f(25))
    input_coordx = InputText((150, DIM_Y), (POS_X + 100, 260),
                             C.WHITE,
                             font=Font.f(25))
    input_coordy = InputText((150, DIM_Y), (POS_X + 250, 260),
                             C.WHITE,
                             font=Font.f(25))
    text_dim = TextBox((100, DIM_Y), (POS_X, 320),
                       C.LIGHT_BLUE,
                       'dim',
                       font=Font.f(25))
    input_dimx = InputText((150, DIM_Y), (POS_X + 100, 320),
                           C.WHITE,
                           font=Font.f(25))
    input_dimy = InputText((150, DIM_Y), (POS_X + 250, 320),
                           C.WHITE,
                           font=Font.f(25))
    text_font = TextBox((200, DIM_Y), (POS_X, 380),
                        C.LIGHT_BLUE,
                        'Fontsize:',
                        font=Font.f(25))
    input_font = InputText((200, DIM_Y), (POS_X + 200, 380),
                           C.WHITE,
                           text='25',
                           font=Font.f(25),
                           limit=4)
    text_color = TextBox((200, DIM_Y), (POS_X, 440),
                         C.LIGHT_BLUE,
                         'Color:',
                         font=Font.f(25))
    input_color = InputText((200, DIM_Y), (POS_X + 200, 440),
                            C.WHITE,
                            text='',
                            font=Font.f(25),
                            pretext='default...')
    color_range = ColorRange((600, 330), (POS_X - 100, 520))

    @classmethod
    def set_pos(cls, pos):
        '''Update the position to have a unscaled relative position'''
        pos = Interface.dim.inv_scale(pos)  # keep precision
        pos[0] -= POS_WIN[0]
        pos[1] -= POS_WIN[1]
        cls.input_coordx.set_text(
            f'{pos[0]:.1f}')  # don't display all decimals
        cls.input_coordy.set_text(f'{pos[1]:.1f}')

    @classmethod
    def set_dim(cls, dim):
        '''Update the dimension to have unscaled dimension'''
        dim = Interface.dim.inv_scale(dim)
        cls.input_dimx.set_text(f'{dim[0]:.1f}')  # don't display all decimals
        cls.input_dimy.set_text(f'{dim[1]:.1f}')

    @classmethod
    def set_obj(cls, obj):
        cls.objtype = obj.objtype
        cls.obj = obj
        cls.activate = True
        # set attr to input
        cls.input_name.set_text(cls.obj.name)
        cls.input_font.set_text(cls.obj.input_text.font['size'])

        # set inp color text: if with pretext or not
        if cls.obj.color_choice == 'text':
            cls.input_color.set_text(cls.obj.color)
        elif cls.obj.color_choice == 'range':
            # set custom as pretext
            cls.input_color.pretext = 'custom...'
            cls.input_color.set_text('', with_pretext=True)
        else:
            cls.input_color.pretext = 'default...'
            cls.input_color.set_text('', with_pretext=True)

        # pos
        cls.set_pos(cls.obj.pos)

        # dim
        cls.set_dim(cls.obj.dim)

        # color range
        if cls.obj.ptr_pos and cls.obj.bptr_pos:
            cls.color_range.pointer.set_pos(cls.obj.ptr_pos, scale=True)
            cls.color_range.bar_pointer.set_pos(cls.obj.bptr_pos, scale=True)
        else:
            # default pos
            cls.color_range.pointer.set_pos((POS_X, 620), scale=True)
            cls.color_range.bar_pointer.set_pos((POS_X + 269, 520), scale=True)
        cls.color_range.set_color_range()

    @classmethod
    def run(cls, events, pressed):
        if cls.activate:
            cls.react_events(events, pressed)
            cls.display()

    @classmethod
    def save(cls):
        # name
        cls.obj.name = cls.input_name.content

        try:
            # scale dim
            dim = (float(cls.input_dimx.content),
                   float(cls.input_dimy.content))
            dim = Interface.dim.scale(dim)
        except:
            print('Incorrect dim')
            dim = cls.obj.dim

        try:
            # scale pos
            pos = [
                float(cls.input_coordx.content),
                float(cls.input_coordy.content)
            ]
            pos[0] += POS_WIN[0]
            pos[1] += POS_WIN[1]
            pos = Interface.dim.scale(pos)
        except:
            print('Incorrect pos')
            pos = cls.obj.pos

        cls.obj.set_new_dim(dim, pos)

        # fontsize
        try:
            font_size = int(cls.input_font.content)
            font = Font.f(font_size)
            cls.obj.input_text.font = font
        except AttributeError:
            print('Incorrect font')

        # color
        try:
            # get text and not content !!! -> see if pretext or not
            str_color = cls.input_color.text
            # check if still default
            if str_color == 'default...':
                color = C.WHITE
                cls.obj.color = 'WHITE'
            else:
                # try to set a predefined color
                try:
                    color = getattr(C, str_color)
                    cls.obj.color = str_color
                    # store that color is chosen by text
                    cls.obj.color_choice = 'text'
                except AttributeError:
                    # get the color range color
                    color = cls.color_range.chosen_color
                    cls.obj.color = color  # in this case a tuple (and not str)
                    cls.obj.color_choice = 'range'

            cls.obj.input_text.set_color(color)
        except:
            print('Incorrect color')

        # color range
        # store in "original" size to be able to rescale in between
        cls.obj.ptr_pos = Interface.dim.inv_scale(cls.color_range.pointer.pos)
        cls.obj.bptr_pos = Interface.dim.inv_scale(
            cls.color_range.bar_pointer.pos)

    @classmethod
    def deselect(cls):
        cls.activate = False
        cls.save()

    @classmethod
    def display(cls):
        cls.text_name.display()
        cls.input_name.display()
        cls.text_coord.display()
        cls.input_coordx.display()
        cls.input_coordy.display()
        cls.text_dim.display()
        cls.input_dimx.display()
        cls.input_dimy.display()
        cls.text_font.display()
        cls.input_font.display()
        cls.text_color.display()
        cls.input_color.display()
        cls.color_range.display()

    @classmethod
    def react_events(cls, events, pressed):
        cls.color_range.react_events(events, pressed)
        cls.input_font.run(events, pressed)
        cls.input_name.run(events, pressed)
        cls.input_color.run(events, pressed)
        cls.input_coordx.run(events, pressed)
        cls.input_coordy.run(events, pressed)
        cls.input_dimx.run(events, pressed)
        cls.input_dimy.run(events, pressed)
예제 #9
0
	def construct(name, label, top_left_x, top_left_y, width, height, h_bezel, v_bezel, TOUCHBAR_OPTION=1):
		touch_screen_device_builder = TouchScreenDeviceBuilder(name, label, top_left_x, top_left_y, width, height)
		
		# Place a screen on the device.
		screen = touch_screen_device_builder.device.create_screen('touchscreen', 'touchscreen', top_left_x + h_bezel, top_left_y + v_bezel, width - 2*h_bezel, height - 2*v_bezel)

		default_textbox_margin = 10
		default_textbox_width = screen.width - 2*default_textbox_margin
		default_textbox_height = ((screen.width - 10) / 30) + 20
		default_textbox_character_width = (screen.width - 10) / 30
		default_textbox_character_height = (screen.width - 10) / 30

		# Place a textbox with transciprion phrase at the top of the screen.
		phrase_textbox = TextBox('phrase_textbox', '', default_textbox_margin, default_textbox_margin, 0, 0, 0, 0)
		screen.add_child(phrase_textbox, default_textbox_margin, default_textbox_margin)

		# Place a textbox with transciprion phrase at the top of the screen.
		transcript_textbox = None
		# transcript_textbox = TextBox('transcription_textbox', '', default_textbox_margin, default_textbox_margin + phrase_textbox.top_left_y + phrase_textbox.height, default_textbox_width, default_textbox_height, default_textbox_character_width, default_textbox_character_height)
		# screen.add_child(transcript_textbox, default_textbox_margin, default_textbox_margin + phrase_textbox.top_left_y + phrase_textbox.height)

		# Place a keyboard at the bottom third of the device.
		keyboard = Interface('keyboard', 'keyboard', 0, 0, screen.width, screen.height)
		screen.add_child(keyboard, 0, 0)

		# Add keys.
		default_key_width = 170
		default_key_height = 170
		default_touchbar_height = 70
		if TOUCHBAR_OPTION == 1:
			touchbar = ['esc','<','light','volumn','mute','siri']
		elif TOUCHBAR_OPTION == 2:
			touchbar = ['vol-', 'slide', 'vol+', 'out']
		elif TOUCHBAR_OPTION == 3:
			touchbar = ['out', 'light-', 'light+', 'layout', 'launchpad', 'keylight-', 'keylight+', '<<', '>||', '>>', 'mute', 'vol-', 'vol+', 'siri']
		elif TOUCHBAR_OPTION == 4:
			touchbar = ['esc',"<-","->","refresh","search","bookmark","newtag","<",'light','volumn','mute','siri']

		key_rows = [touchbar,\
		["~\n`",'1','2','3','4','5','6','7','8','9','0',"_\n-","+\n=",'del'],\
		['tab','q','w','e','r','t','y','u','i','o','p',"{\n[","}\n]","|\n\\"],\
		['cap','a','s','d','f','g','h','j','k','l',":\n;","\"\n\'",'return'],\
		['shift1','z','x','c','v','b','n','m',"<\n,",">\n.","?\n/",'shift2'],\
		['fn','ctrl','opt1','cmd1',' ','cmd2','opt2','left',"up\ndown",'right']]

		# Starting key positions.
		key_top_left_x = 0
		key_top_left_y = 0

		for key_row, idx in zip(key_rows, range(len(key_rows))):
			key_width = default_key_width
			key_height = default_key_height

			key_top_left_x = 0
			if idx == 0 and TOUCHBAR_OPTION == 1:
				key_height = default_touchbar_height
				# esc
				key_top_left_x = 110
				key_button = KeyboardKey(key_row[0], key_row[0], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# <
				key_top_left_x += 140 + 1550
				key_button = KeyboardKey(key_row[1], key_row[1], key_top_left_x, 0, 30, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				key_top_left_x += 30
				for i in range(4):
					key_button = KeyboardKey(key_row[i+2], key_row[i+2], key_top_left_x, 0, 160, key_height, transcript_textbox)
					keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
					key_top_left_x += 160
			elif idx == 0 and TOUCHBAR_OPTION == 2:
				key_height = default_touchbar_height
				# vol-
				key_top_left_x = 1250
				key_button = KeyboardKey(key_row[0], key_row[0], key_top_left_x, 0, 150, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# slide
				key_top_left_x += 150
				key_button = KeyboardKey(key_row[1], key_row[1], key_top_left_x, 0, 520, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# vol-
				key_top_left_x += 520
				key_button = KeyboardKey(key_row[2], key_row[2], key_top_left_x, 0, 150, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# out
				key_top_left_x += 150
				key_button = KeyboardKey(key_row[3], key_row[3], key_top_left_x, 0, 100, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
			elif idx == 0 and TOUCHBAR_OPTION == 3:
				key_height = default_touchbar_height
				# out
				key_top_left_x = 110
				key_button = KeyboardKey(key_row[0], key_row[0], key_top_left_x, 0, 120, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# light-
				key_top_left_x += 120 + 60
				key_button = KeyboardKey(key_row[1], key_row[1], key_top_left_x, 0, 165, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# light+
				key_top_left_x += 165
				key_button = KeyboardKey(key_row[2], key_row[2], key_top_left_x, 0, 165, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# layout
				key_top_left_x += 165 + 35
				key_button = KeyboardKey(key_row[3], key_row[3], key_top_left_x, 0, 165, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# launchpad
				key_top_left_x += 165 + 35
				key_button = KeyboardKey(key_row[4], key_row[4], key_top_left_x, 0, 165, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# keylight-
				key_top_left_x += 165 + 35
				key_button = KeyboardKey(key_row[5], key_row[5], key_top_left_x, 0, 165, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# keylight+
				key_top_left_x += 165
				key_button = KeyboardKey(key_row[6], key_row[6], key_top_left_x, 0, 165, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# <<
				key_top_left_x += 165 + 35
				key_button = KeyboardKey(key_row[7], key_row[7], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# >||
				key_top_left_x += 140
				key_button = KeyboardKey(key_row[8], key_row[8], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# >>
				key_top_left_x += 140
				key_button = KeyboardKey(key_row[9], key_row[9], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# mute
				key_top_left_x += 140 + 35
				key_button = KeyboardKey(key_row[10], key_row[10], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# vol-
				key_top_left_x += 140
				key_button = KeyboardKey(key_row[11], key_row[11], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# vol+
				key_top_left_x += 140
				key_button = KeyboardKey(key_row[12], key_row[12], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# siri
				key_top_left_x += 140 + 35
				key_button = KeyboardKey(key_row[13], key_row[13], key_top_left_x, 0, 165, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
			elif idx == 0 and TOUCHBAR_OPTION == 4:
				key_height = default_touchbar_height
				# out
				key_top_left_x += 110
				key_button = KeyboardKey(key_row[0], key_row[0], key_top_left_x, 0, 140, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# <-
				key_top_left_x += 140 + 35
				key_button = KeyboardKey(key_row[1], key_row[1], key_top_left_x, 0, 160, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# ->
				key_top_left_x += 160 + 15
				key_button = KeyboardKey(key_row[2], key_row[2], key_top_left_x, 0, 160, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# refresh
				key_top_left_x += 160 + 15
				key_button = KeyboardKey(key_row[3], key_row[3], key_top_left_x, 0, 160, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# search
				key_top_left_x += 160 + 15
				key_button = KeyboardKey(key_row[4], key_row[4], key_top_left_x, 0, 620, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# bookmark
				key_top_left_x += 620 + 15
				key_button = KeyboardKey(key_row[5], key_row[5], key_top_left_x, 0, 160, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# newtag
				key_top_left_x += 160 + 15
				key_button = KeyboardKey(key_row[6], key_row[6], key_top_left_x, 0, 160, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				# <
				key_top_left_x += 160 + 35
				key_button = KeyboardKey(key_row[7], key_row[7], key_top_left_x, 0, 30, key_height, transcript_textbox)
				keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
				key_top_left_x += 30
				for i in range(4):
					key_button = KeyboardKey(key_row[i+8], key_row[i+8], key_top_left_x, 0, 160, key_height, transcript_textbox)
					keyboard.add_child(key_button, key_top_left_x, key_top_left_y)
					key_top_left_x += 160




			else:
				for key in key_row:
					if key in ['del','tab']:
						key_width = 260
					elif key in ['cap','return']:
						key_width = 305
					elif key in ['shift1',"shift2"]:
						key_width = 395
					elif key in ['cmd1','cmd2']:
						key_width = 215
					elif key in [' ']:
						key_width = 890
					else:
						key_width = 170
					key_button = KeyboardKey(key, key, key_top_left_x, key_top_left_y, key_width, key_height, transcript_textbox)

					keyboard.add_child(key_button, key_top_left_x, key_top_left_y)

					key_top_left_x += key_width + 10

			if idx == 0:
				key_top_left_y += key_height + 40
			else:
				key_top_left_y += key_height + 10

		return touch_screen_device_builder.set_screen(screen, screen.top_left_x, screen.top_left_y).get_result()