Changeset dbcb255 in ammosreader for sample_scripts/ammos_viewer.py


Ignore:
Timestamp:
07/22/22 10:53:02 (3 years ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
AmmosSource, guix
Children:
5d039b8
Parents:
19ee734
Message:

ammosviewer minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sample_scripts/ammos_viewer.py

    r19ee734 rdbcb255  
    33import tkinter as tk
    44from PIL import Image, ImageTk
    5 from random import randbytes
     5# from random import randbytes
    66import bitstring
    77
     
    2424        self.cycle.set(self.ammos_container.unique_frame_sizes()[0])
    2525        self.cache = tk.IntVar()
    26         self.cache.set(500000000)
     26        self.cache.set(500)
    2727        self.canvas_size = (800, 600)
    2828        self.offset = tk.IntVar()
     
    3939        self.canvas = tk.Canvas(image_frame, bg="#000000", width=self.canvas_size[0], height=self.canvas_size[1])
    4040        self.canvas.pack()
    41         pil_image = Image.frombytes("L", self.canvas_size, self.current_bytes())
     41        pil_image = Image.frombytes("1", self.canvas_size, self.current_bytes())
    4242        self.image = ImageTk.PhotoImage(pil_image)
    4343        # pil_image.show()
     
    5050        self.cycle_entry.pack(side=tk.TOP)
    5151
    52         tk.Label(button_frame, text='Cache in bytes').pack(side=tk.TOP)
     52        tk.Label(button_frame, text='Cache in Megabytes').pack(side=tk.TOP)
    5353        self.cache_entry = tk.Entry(button_frame, text=self.cache)
    5454        self.cache_entry.pack(side=tk.TOP)
     
    7676
    7777    def current_bytes(self):
     78        """I return the current bytes to display in the canvas."""
    7879        if self.offset.get() % 8 == 0:
    7980            return b"".join([self.bytes[each: each+self.canvas_size[0]] for each in range(self.offset.get(),
     
    8788
    8889    def update_canvas(self):
     90        """I update the canvas."""
    8991        self.image = ImageTk.PhotoImage(Image.frombytes("L", self.canvas_size, self.current_bytes()))
    9092        self.canvas.itemconfig(self.image_id, image=self.image)
    9193
    9294    def load_file(self):
     95        """I load a binary ammos file."""
    9396        pass
    9497
    9598    def quit(self):
     99        """I quit the application."""
    96100        self.parent.destroy()
    97101
Note: See TracChangeset for help on using the changeset viewer.