def __init__(self, cfg, cpu, memory, display_callback, user_input_queue): self.cfg = cfg self.cpu = cpu self.user_input_queue = user_input_queue super(Dragon32PeripheryUnittest, self).__init__(cfg, cpu, memory, self.user_input_queue) self.rows = 32 self.columns = 16 # Contains the map from Display RAM value to char/color: self.charmap = get_charmap_dict() # redirect writes to display RAM area 0x0400-0x0600 into display_queue: self.memory.add_write_byte_middleware(self.to_line_buffer, 0x0400, 0x0600)
def __init__(self, cfg, cpu, memory, display_callback, user_input_queue): self.cfg = cfg self.cpu = cpu self.user_input_queue = user_input_queue super(Dragon32PeripheryUnittest, self).__init__(cfg, cpu, memory, self.user_input_queue) self.rows = 32 self.columns = 16 # Contains the map from Display RAM value to char/color: self.charmap = get_charmap_dict() # redirect writes to display RAM area 0x0400-0x0600 into display_queue: self.memory.add_write_byte_middleware( self.to_line_buffer, 0x0400, 0x0600 )
def __init__(self, root): self.rows = 32 self.columns = 16 scale_factor = 2 # scale the complete Display/Characters self.tk_font = TkImageFont(CHARS_DICT, scale_factor) # to generate PhotoImage() self.total_width = self.tk_font.width_scaled * self.rows self.total_height = self.tk_font.height_scaled * self.columns foreground, background = dragon_charmap.get_hex_color( dragon_charmap.NORMAL) self.canvas = tkinter.Canvas( root, width=self.total_width, height=self.total_height, bd=0, # no border highlightthickness=0, # no highlight border # bg="#ff0000", bg="#%s" % background, ) # Contains the map from Display RAM value to char/color: self.charmap = get_charmap_dict() # Cache for the generated Tkinter.PhotoImage() in evry char/color combination: self.image_cache = {} # Tkinter.PhotoImage() IDs for image replace with canvas.itemconfigure(): self.images_map = {} # Create all charachter images on the display and fill self.images_map: self.init_img = self.tk_font.get_char(char="?", color=dragon_charmap.INVERTED) for row in xrange(self.rows + 1): for column in xrange(self.columns + 1): x = self.tk_font.width_scaled * row y = self.tk_font.height_scaled * column image_id = self.canvas.create_image( x, y, image=self.init_img, state="normal", anchor=tkinter.NW # NW == NorthWest ) # log.critical("Image ID: %s at %i x %i", image_id, x, y) self.images_map[(x, y)] = image_id
def __init__(self, root): self.rows = 32 self.columns = 16 scale_factor = 2 # scale the complete Display/Characters self.tk_font = TkImageFont(CHARS_DICT, scale_factor) # to generate PhotoImage() self.total_width = self.tk_font.width_scaled * self.rows self.total_height = self.tk_font.height_scaled * self.columns foreground, background = dragon_charmap.get_hex_color(dragon_charmap.NORMAL) self.canvas = tkinter.Canvas(root, width=self.total_width, height=self.total_height, bd=0, # no border highlightthickness=0, # no highlight border # bg="#ff0000", bg="#%s" % background, ) # Contains the map from Display RAM value to char/color: self.charmap = get_charmap_dict() # Cache for the generated Tkinter.PhotoImage() in evry char/color combination: self.image_cache = {} # Tkinter.PhotoImage() IDs for image replace with canvas.itemconfigure(): self.images_map = {} # Create all charachter images on the display and fill self.images_map: self.init_img = self.tk_font.get_char(char="?", color=dragon_charmap.INVERTED) for row in xrange(self.rows + 1): for column in xrange(self.columns + 1): x = self.tk_font.width_scaled * row y = self.tk_font.height_scaled * column image_id = self.canvas.create_image(x, y, image=self.init_img, state="normal", anchor=tkinter.NW # NW == NorthWest ) # log.critical("Image ID: %s at %i x %i", image_id, x, y) self.images_map[(x, y)] = image_id