Jun-21-2018, 05:07 PM
Hi Gangadhararao
Here my test script. It is absolutly not optimized. I just tried to interpret your script to create the following test script. I tested it with Ubuntu 18.04, Tkinter Tk8.6, Python 3.5. For images in the .jpg-format the PIL-Module is needed!:
Here my test script. It is absolutly not optimized. I just tried to interpret your script to create the following test script. I tested it with Ubuntu 18.04, Tkinter Tk8.6, Python 3.5. For images in the .jpg-format the PIL-Module is needed!:
import os from functools import partial import subprocess import tkinter as tk APP_TITLE = "Image Display" APP_XPOS = 100 APP_YPOS = 100 APP_WIDTH = 350 APP_HEIGHT = 200 class Application(tk.Frame): def __init__(self, master): self.master = master tk.Frame.__init__(self, master) self.build() def build(self): # Heading self.heading = tk.Label(self, text="BBS", bg="black", fg="orange" , font=("Times New Roman", 50)) self.heading.pack() #place(x = 350, y = 0) self.label = tk.Label(self, text="MAIN MENU", bg="white", fg="orange", font=("Times New Roman", 50)) self.label.pack() # Your image with path self.image = tk.PhotoImage(file=r"C:\ti\c2000\C2000Ware_1_00_04_00\utilities\flash_programmers\serial_flash_programmer\bbs.gif") # My test image #self.image = tk.PhotoImage(file="image.gif") self.image_width = self.image.width() self.image_height = self.image.height() self.canvas = tk.Canvas(self, width=self.image_width, height=self.image_height) self.canvas.pack() self.canvas.create_image(0, 0, anchor='nw', image=self.image) self.control_frame = tk.Frame(self) self.control_frame.pack() input_label = tk.Label(self.control_frame, text="Firmware Downloading to \n TMS320F2833x", bg="white", fg="blue" ,font=("Times New Roman", 20)) input_label.grid(row=0, column=0) input_entry = tk.Entry(self.control_frame, bg="white", fg="green", font=("Times New Roman", 20)) input_entry.grid(row=1, column=0) input_entry.focus_set() submit_button = tk.Button(self.control_frame, text = "Submit", bg="brown", fg="yellow", font=("Times New Roman", 20), command=partial(self.submit_callback , input_entry)) submit_button.grid(row=2, column=0) def submit_callback(self, input_entry): print("User entered : " + input_entry.get()) return cmd = subprocess.Popen("cmd.exe /K cd C:\\ti\\c2000\\C2000Ware_1_00_04_00\\utilities\\flash_programmers\\serial_flash_programmer & serial_flash_programmer.exe -d f2803x -k f28335_flash_kernel.txt -a PQCR.i00 -p COM7 -b 9600 -v") os.system("cd C:\\ti\\c2000\\C2000Ware_1_00_04_00\\utilities\\flash_programmers\\serial_flash_programmer") os.system("serial_flash_programmer.exe -d f2803x -k f28335_flash_kernel.txt -a PQCR.i00 -p COM3 -b 9600 -v & pause") def main(): app_win = tk.Tk() app_win.title(APP_TITLE) app_win.geometry("+{}+{}".format(APP_XPOS, APP_YPOS)) #app_win.geometry("{}x{}".format(APP_WIDTH, APP_HEIGHT)) app = Application(app_win) app.pack(fill='both', expand=True) app_win.mainloop() if __name__ == '__main__': main()wuf ;-)