-1

I pretend to create two frames in this window, one at my left only showing a picture (I'd like it in the middle and not on the left side of the frame ) and the other frame to show a noteboook with different choices for testing the device shown in the picture.

Why I cannot see the picture?

if I disable the notebook to be shown in the second Frame then I can see it.

#This module is used to UUTs corresponding to adapter A0001,
#(units 4039891-xxx, 4039892-xxx and 4039893-xxx) 
#according to the following list of serial ports:
#COM1 -> DMM
#COM2 -> DCPS No.1 
#COM3 -> DCPS No.2 
#COM4 -> FPGA No.4 (Console)
#COM5 -> FGEN
#COM6 -> DIG.OSC.
#COM7 -> FPGA No.1 (Matrix_1)
#COM8 -> FPGA No.2 (Matrix_2)
#COM9 -> FPGA No.3 (Matrix_3)

import sys
from tkinter import *
from tkinter import ttk
import time
from random import randint, choice
from PIL import ImageTk, Image
import os
import Pmw

def donothing():
   filewin = Toplevel() 
   filewin.geometry('480x200+100+100')
   button = Button(filewin, text="APAS- ATE (Automatic Test Equipment Report).", command=filewin.destroy)
   button.pack()

def SI800_903():
    #workorder=work_var.get()
    #serial=serial_var.get()
    #tech=tech_var.get()
    #date=date_var.get()
    #f = open("WO" + workorder + ".txt","w")
    
    SI800_ATP = Toplevel()
    SI800_ATP.geometry('1500x830+200+160')
    SI800_ATP.title("Universal ATLAS Acceptance Test Procedure")
    SI800_ATP.resizable(False, False)
    SI800_ATP.focus_set()   
    img = ImageTk.PhotoImage(Image.open("DMM.jpg")) 
    
    # create a Frame 1 to see the picture
    PIC=ttk.Frame(SI800_ATP)
    PIC.pack(side="left")

    imglabel = Label(PIC, image=img, borderwidth=1, relief="solid").pack()
    #Label(PIC, text ="                  ",font = ('Arial', 15, "bold")).pack()
    
    # create a notebook in Frame 2
    TABS=ttk.Frame(SI800_ATP)
    TABS.pack(side="top")   
    note = ttk.Notebook(TABS)
    note.pack(expand=1, fill="both")
    
    #tab0 = ttk.Frame(note)
    tabbit = ttk.Frame(note)
    tab1 = ttk.Frame(note)
    tab2 = ttk.Frame(note)
    tab3 = ttk.Frame(note)
    tab4 = ttk.Frame(note)
    tab5 = ttk.Frame(note)
    tab6 = ttk.Frame(note)
    tab7 = ttk.Frame(note)
    tab8 = ttk.Frame(note)
    tab9 = ttk.Frame(note)
    tab10 = ttk.Frame(note)
    tab11 = ttk.Frame(note)
    
    #Initial Position presentation
    Label(tabbit, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tabbit, text ="Initial Positions.",font = ('Arial', 15, "bold")).pack()
    Label(tabbit, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tabbit, text ="The purpose of this test is to find if",font = ('Arial', 12)).pack()   
    Label(tabbit, text ="there is a problem in the operation of the indicator.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="Electrostatic discharge (ESD) events can harm electronic components inside ",font = ('Arial', 12)).pack()
    Label(tabbit, text ="your instrument under test. ",font = ('Arial', 12)).pack()
    Label(tabbit, text ="                  ",font = ('Arial', 12, "bold")).pack()
    Label(tabbit, text ="When connecting a unit under test to the ATE, you should always ground both",font = ('Arial', 12)).pack()
    Label(tabbit, text ="yourself and the unit before connecting it to the ATE.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="Connect the ADAPTER_0001 to the Matrix module on the ATE.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="Observe correct position of the connectors.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="                  ",font = ('Arial', 12, "bold")).pack()
    Label(tabbit, text ="This program was developed to run the test procedure to test the indicator and isolate faults.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="Always keep the unit on an antistatic mat and observe before connecting it to the adapter",font = ('Arial', 12)).pack()
    Label(tabbit, text ="that the power supplies in the Console module are not applied to the adapter in question.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="The adapter will always have an indicator either AC or DC that will quickly show you that it is totally de-energized.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="                  ",font = ('Arial', 12, "bold")).pack()
    Label(tabbit, text ="Before starting and during the development of the entire test procedure,",font = ('Arial', 12)).pack()
    Label(tabbit, text ="strictly observe the security measures oriented in the workshop.Never undertake the operation ",font = ('Arial', 12)).pack()
    Label(tabbit, text ="of the ATE or the testing of any unit without first having received proper training.",font = ('Arial', 12)).pack()
    Label(tabbit, text ="                  ",font = ('Arial', 12, "bold")).pack()
    
    #Test 1 presentation
    Label(tab1, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab1, text ="Test 1: Dielectric Breakdown and Insulation Resistance",font = ('Arial', 14, "bold")).pack()
    Label(tab1, text ="                          ", font = ('Arial', 12)).pack()
    Label(tab1, text ="During all tests except Integral Lighting and Dielectric Breakdown and Insulation", font = ('Arial', 12)).pack()
    Label(tab1, text ="Resistance, flags shall be energized continuously to simulate in use conditions.", font = ('Arial', 12)).pack()
    Label(tab1, text ="                          ", font = ('Arial', 12)).pack()
    Label(tab1, text ="For Dielectric Breakdown and Insulation Test, please ", font = ('Arial', 12)).pack()
    Label(tab1, text ="follow the Test Procedure as described in the CMM.", font = ('Arial', 12)).pack()
    Label(tab1, text ="                          ", font = ('Arial', 12)).pack()
    Button(tab1, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 2 presentation
    Label(tab2, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab2, text ="Test 2: Warmup.",font = ('Arial', 14, "bold")).pack()
    Label(tab2, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab2, text ="When primary power is initially applied, the Indicator shall respond as shown, ", font = ('Arial', 12)).pack()
    Label(tab2, text ="25 seconds Flags out of view. Pointers shall start slewing smoothly toward NORMAL OP conditions. ", font = ('Arial', 12)).pack()
    Label(tab2, text ="                          ", font = ('Arial', 12)).pack()
    Label(tab2, text ="To simulate this...", font = ('Arial', 12)).pack()
    Label(tab2, text ="Press Enter and simulataneously start timer.", font = ('Arial', 12)).pack()
    Label(tab2, text ="When the timer reaches 0. Indicator shall begin to functions as shown within 25 seconds. ", font = ('Arial', 12)).pack()
    Label(tab2, text ="25 seconds Flags out of view. Pointers shall start slewing smoothly toward NORMAL OP conditions. ", font = ('Arial', 12)).pack()
    Label(tab2, text ="                          ", font = ('Arial', 12)).pack()
    Button(tab2, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 3 presentation
    Label(tab3, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab3, text ="Test 3: Loss of Power.",font = ('Arial', 14, "bold")).pack()
    Label(tab3, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab3, text ="With the input power removed, the Indicator shall respond as shown.", font = ('Arial', 12)).pack()
    Label(tab3, text ="All failure flags in view -A/S, Mach, Vmo and (on -903, -904, -906,-907) INOP. ", font = ('Arial', 12)).pack()
    Label(tab3, text ="                          ", font = ('Arial', 12)).pack()
    Label(tab3, text ="With power returned, the Indicator shall respond as shown", font = ('Arial', 12)).pack()
    Label(tab3, text ="Flags out of view; display elements agree with fixture.", font = ('Arial', 12)).pack()
    Label(tab3, text ="No change in any display, no failure indications.", font = ('Arial', 12)).pack() 
    Label(tab3, text ="                          ", font = ('Arial', 12)).pack()
    Button(tab3, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 4 presentation
    Label(tab4, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab4, text ="Test 4: Invalid Data.",font = ('Arial', 14, "bold")).pack()
    Label(tab4, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab4, text ="The DMA circuits and digital bus inputs are monitored by a sign/status matrix.", font = ('Arial', 12)).pack()
    Label(tab4, text ="The sign/status matrix contains the valid status of the digital word.", font = ('Arial', 12)).pack()
    Label(tab4, text =" When a data word is pulled from RAM, it is replaced with the matrix word revised to show FAIL.", font = ('Arial', 12)).pack()
    Label(tab4, text ="                          ", font = ('Arial', 12)).pack()
    Label(tab4, text ="If the DMA does not update the RAM location ", font = ('Arial', 12)).pack()
    Label(tab4, text ="with the failed word in a specified time period, ", font = ('Arial', 12)).pack()
    Label(tab4, text ="the microprocessor signals a data failure code. Reception of the", font = ('Arial', 12)).pack()
    Label(tab4, text ="invalid data code causes the appropriate flag to appear.", font = ('Arial', 12)).pack()
    Label(tab4, text ="                          ", font = ('Arial', 12)).pack()
    Button(tab4, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 5 presentation
    Label(tab5, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab5, text ="Test 5: No Computed Data.",font = ('Arial', 14, "bold")).pack()
    Label(tab5, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab5, text ="The DMA circuits and digital bus inputs are monitored by a sign/status matrix.", font = ('Arial', 12)).pack()
    Label(tab5, text ="The sign/status matrix contains the valid status of the digital word.", font = ('Arial', 12)).pack()
    Label(tab5, text ="When a data word is pulled from RAM, it is replaced with the matrix word revised to show FAIL.", font = ('Arial', 12)).pack()
    Label(tab5, text ="                          ", font = ('Arial', 12)).pack()
    Label(tab5, text ="If the DMA does not update the RAM location ", font = ('Arial', 12)).pack()
    Label(tab5, text ="with the failed word in a specified time period, ", font = ('Arial', 12)).pack()
    Label(tab5, text ="the microprocessor signals a data failure code. Reception of the", font = ('Arial', 12)).pack()
    Label(tab5, text ="no computed data (NCD) code causes the appropriate flag to appear.", font = ('Arial', 12)).pack()
    Label(tab5, text ="                          ", font = ('Arial', 12)).pack()
    Button(tab5, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 6 presentation
    Label(tab6, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab6, text ="Test 6: Absence of Input Signal.",font = ('Arial', 14, "bold")).pack()
    Label(tab6, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab6, text ="All input signals shall be applied between", font = ('Arial', 12)).pack()
    Label(tab6, text ="the designated terminal and signal ground,", font = ('Arial', 12)).pack()
    Label(tab6, text ="unless otherwise stated.", font = ('Arial', 12)).pack()
    Label(tab6, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab6, text ="The two buses are redundant and contain 32 bits of data. Eight bits are used for", font = ('Arial', 12)).pack()
    Label(tab6, text ="addresses and 24 bits for display data. An open (BUS SEL) selects the", font = ('Arial', 12)).pack()
    Label(tab6, text ="ADC1 data. When grounded, ADC2 is selected.", font = ('Arial', 12)).pack()
    Label(tab6, text ="                          ", font = ('Arial', 12)).pack()
    Label(tab6, text ="The open/ground condition applied selects the appropriate ADC bus.", font = ('Arial', 12)).pack()
    Label(tab6, text ="This test is to verify the Indicator response when no signal is present on the primary data bus. ", font = ('Arial', 12)).pack()
    Label(tab6, text ="the Indicator shall respond as shown.", font = ('Arial', 12)).pack()
    Label(tab6, text ="                          ", font = ('Arial', 12)).pack()
    Button(tab6, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 7 presentation
    Label(tab7, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab7, text ="Test 7: Slew Rates.",font = ('Arial', 14, "bold")).pack()
    Label(tab7, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab7, text ="Input a computed airspeed signal", font = ('Arial', 12)).pack()
    Label(tab7, text ="changing at a rate of 1012.5 knots ", font = ('Arial', 12)).pack()
    Label(tab7, text ="per minute. The display shall respond in a proper form.", font = ('Arial', 12)).pack()
    Label(tab7, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Button(tab7, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 8 presentation
    Label(tab8, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab8, text ="Test 8: Threshold Sensitivity.",font = ('Arial', 14, "bold")).pack()
    Label(tab8, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab8, text ="When the computed airspeed input signal is", font = ('Arial', 12)).pack()
    Label(tab8, text ="changed from 100 to 100.25 knots, the CAS pointer", font = ('Arial', 12)).pack()
    Label(tab8, text ="and counter shall move perceptibly.", font = ('Arial', 12)).pack()
    Label(tab8, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Button(tab8, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 9 presentation
    Label(tab9, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab9, text ="Test 9: Display Stops.",font = ('Arial', 14, "bold")).pack()
    Label(tab9, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Label(tab9, text ="In the process of dynamic tracking of input data during the accuracy test, the", font = ('Arial', 12)).pack()
    Label(tab9, text ="display functions shall move smoothly without", font = ('Arial', 12)).pack()
    Label(tab9, text ="hunting, oscillating, sticking, or jumping", font = ('Arial', 12)).pack()
    Label(tab9, text ="when changes of input signals are received.", font = ('Arial', 12)).pack()
    Label(tab9, text ="                          ", font = ('Arial', 12, "bold")).pack()
    Button(tab9, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    # Test 10 presentation
    Label(tab10, text ="                  ",font = ('Arial', 15, "bold")).pack()
    Label(tab10, text ="Test 10: Accuracy.",font = ('Arial', 14, "bold")).pack()
    Label(tab10, text ="                         ", font = ('Arial', 12, "bold")).pack()
    Label(tab10, text ="In the process of dynamic tracking of input data during the accuracy test, the", font = ('Arial', 12)).pack()
    Label(tab10, text ="display functions shall move smoothly without", font = ('Arial', 12)).pack()
    Label(tab10, text ="hunting, oscillating, sticking, or jumping", font = ('Arial', 12)).pack()
    Label(tab10, text ="when changes of input signals are received.", font = ('Arial', 12)).pack()
    Label(tab10, text ="                         ", font = ('Arial', 12, "bold")).pack()
    Button(tab10, text='Enter',font = ('Arial', 12, "bold"), command = donothing).pack(padx=0, pady=0)
    
    note.add(tabbit, text = "  Initial Positions   ", compound=TOP)
    note.add(tab1, text = "  Test 1     ")
    note.add(tab2, text = "  Test 2     ")
    note.add(tab3, text = "  Test 3     ")
    note.add(tab4, text = "  Test 4     ")
    note.add(tab5, text = "  Test 5     ")
    note.add(tab6, text = "  Test 6     ")
    note.add(tab7, text = "  Test 7     ")
    note.add(tab8, text = "  Test 8     ")
    note.add(tab9, text = "  Test 9     ")
    note.add(tab10, text = "  Test 10     ")
    note.pack()

def SI800_903_Test():
    SI800_903_ATP = Toplevel()
    SI800_903_ATP.title("  Model SI-800      Airspeed/Mach Indicator      P.N: 4039891-903            ATA: 34-13-09                                       Acceptance Test Procedure")   
    SI800_903_ATP.geometry('1700x950+100+70')
    SI800_903_ATP.resizable(False, False)
    SI800_903_ATP.focus_set()
    
    #variables
    work_var=StringVar()
    serial_var=StringVar()
    tech_var=StringVar() 
    date_var=StringVar()
    
    # creating a label for the repair order window
    workorder=work_var.get()
    serial=serial_var.get()
    tech=tech_var.get()
    date=date_var.get()
    
    #frame #1 
    input_frame=Frame(SI800_903_ATP, height=10)
    input_frame.pack()
    # creating a label for name using widget Label
    work_label = Label(input_frame, text = 'W.O: ', font=('Arial',11, 'bold')).pack(side="left", padx=10, pady=20)
    # creating a entry for input name using widget Entry
    work_entry = Entry(input_frame,textvariable = work_var, font=('Arial',11,'normal')).pack(side="left")
    #work_entry.focus()
    
    ro_label = Label(input_frame, text = '                              ', font=('Arial',11, 'normal')).pack(side="left")   
        
    # creating a label for password
    serial_label = Label(input_frame, text = 'S/N: ', font = ('Arial',11,'bold')).pack(side="left")
    # creating a entry for password
    serial_entry=Entry(input_frame, textvariable = serial_var, font = ('Arial',11,'normal')).pack(side="left")
    
    ro_label = Label(input_frame, text = '                              ', font=('Arial',11, 'normal')).pack(side="left")   
    
    # creating a label for password
    tech_label = Label(input_frame, text = '     Technician: ', font = ('Arial',11,'bold')).pack(side="left")
    # creating a entry for password
    tech_entry= Entry(input_frame, textvariable = tech_var, font = ('Arial',11,'normal')).pack(side="left")
    
    ro_label = Label(input_frame, text = '                              ', font=('Arial',11, 'normal')).pack(side="left")
    
    # creating a label for password
    date_label = Label(input_frame, text = 'Date: ', font = ('Arial',11,'bold')).pack(side="left")
    # creating a entry for password
    date_entry= Entry(input_frame, textvariable = date_var, font = ('Arial',11,'normal')).pack(side="left")
    
    ro_label = Label(input_frame, text = '                              ', font=('Arial',11, 'normal')).pack()
    
    # creating a button using the widget
    # Button that will call the repair_order function

    #frame #2
    test_frame=Frame(SI800_903_ATP, height=10)
    test_frame.pack()
    Label(SI800_903_ATP,text ="                          ", font = ('Arial', 12, "bold")).pack()    
    sub_btn= Button(test_frame,text = 'Start Test Procedure', font=('Arial',11, 'bold'), command = SI800_903).pack(side="top", fill="x", expand=FALSE)  
    
    
    SI800_903_ATP.mainloop()

  • Please [edit] your question to include a [mcve]. You seem to have posted a considerable amount of irrelevant code. Also, see https://stackoverflow.com/questions/16424091/why-does-tkinter-image-not-show-up-if-created-in-a-function – Bryan Oakley Jan 30 '23 at 21:15
  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Jan 31 '23 at 09:52

1 Answers1

0

too long code to check anything, but have you checked if packing PIC side='left' and packing TAB side='top' has something to do?

normally if you pack one on the left, pack the other on the rigth.

mamg2909
  • 96
  • 4