Not sure if this is what you want.
#! /usr/bin/env python3 # Do the imports from skimage.io import imread, imshow import tkinter as tk from tkinter import filedialog from os import sys # Start tkinter root = tk.Tk() root['padx'] = 20 root.geometry('800x600+250+250') root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) # Function for getting and displaying image def get_image(): file = filedialog.askopenfilename(title='image file') img = tk.PhotoImage(file=file) img.back = img label = tk.Label(container, image=img) label['relief'] = 'ridge' label.grid(column=0, row=0, sticky='new', padx=2) col = 0 row = 0 # Use imread to get raw image data imag = imread(file) # Clear any data then insert new data into a listbox box.delete(0, tk.END) for im in imag: box.insert(tk.END, im) # Container frame container = tk.Frame(root) container.grid(column=0, row=0, sticky='news') container.grid_columnconfigure(0, weight=3, uniform='win') container.grid_columnconfigure(1, weight=3, uniform='win') # Button to get the image btn = tk.Button(container, text='Get Image', command=get_image) btn.grid(column=1, row=0, sticky='new', pady=10, padx=2) # Frame for listbox containing raw image data frame = tk.Frame(container) frame.grid(column=0, row=1, columnspan=2, sticky='news') # Scrollbars scrollbar = tk.Scrollbar(frame, orient='vertical') scrollbar2 = tk.Scrollbar(frame, orient='horizontal') box = tk.Listbox(frame, width=123, height=24) box['yscrollcommand'] = scrollbar.set box['xscrollcommand'] = scrollbar2.set scrollbar.configure(command=box.yview) scrollbar2.configure(command=box.xview) scrollbar.grid(column=1, row=0, sticky='news') scrollbar2.grid(column=0, row=1, sticky='news') box.grid(column=0, row=0, sticky='news') # Bind the q and esc keys to exit when pressed root.bind('<q>', sys.exit) root.bind('<Escape>', sys.exit) # Automatic close after 5 minutes root.after(50000, sys.exit) root.mainloop()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags