Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter
#3
from tkinter import *
#from tkinter import ttk

def donothing():
    filewin = Toplevel(root)
    button = Button(filewin, text="Do nothing button")
    button.pack()
 
def close_window(root): 
    window.destroy()
 
def ending_session():
   print("==================================================")
   print("Closing session.....")
   print("\n")
   print("...Bye")
   print("\n")
   print("==================================================")
   from tkinter import messagebox
   messagebox.showinfo(message='Have a good day')
    
def new_session():
   CDU_newsession = Tk()
   CDU_newsession.geometry('460x140+170+80')
#   CDU_session.title("New Test Session")
   CDU_newsession.overrideredirect(1)  #it removes the top badge
   print("==================================================")
   print("Test Procedure")
   print("Liquid Crystal Display Control Display Unit")
   print("174101  Model 2584")
   print("ATA 34-61-14, ATLAS Test Specification 552353-10-01\n")
   Label(CDU_newsession, text ="        Work Order:",font = ('Arial', 12, "bold")).grid(row=1, column=0, sticky='E')
   Label(CDU_newsession, text ="       Part Number:",font = ('Arial', 12, "bold")).grid(row=2, column=0, sticky='E')
   Label(CDU_newsession, text ="     Serial Number:",font = ('Arial', 12, "bold")).grid(row=3, column=0, sticky='E')
   Label(CDU_newsession, text ="     Starting Date:",font = ('Arial', 12, "bold")).grid(row=4, column=0, sticky='E')
   Label(CDU_newsession, text ="        Technician:",font = ('Arial', 12, "bold")).grid(row=5, column=0, sticky='S')

   UUT_WOnew = Entry(CDU_newsession, width=15)
   UUT_PNnew = Entry(CDU_newsession, width=15)
   UUT_SNnew = Entry(CDU_newsession, width=15)
   UUT_SDnew = Entry(CDU_newsession, width=15)
   UUT_Technew = Entry(CDU_newsession, width=20)

   UUT_WOnew.grid(row=1, column=1, sticky='W')
   UUT_PNnew.grid(row=2, column=1, sticky='W')
   UUT_SNnew.grid(row=3, column=1, sticky='W')
   UUT_SDnew.grid(row=4, column=1, sticky='W')
   UUT_Technew.grid(row=5, column=1, sticky='W')
   
   Button(CDU_newsession, text ="Test Procedure",font = ('Arial', 12, "bold"), command = test_procedure).grid(row=15 , column=2, sticky='W', padx=2)

   
def open_session():
   CDU_opensession = Tk()
   CDU_opensession.geometry('405x85+200+80')
#   CDU_session.title("New Test Session")
   CDU_opensession.overrideredirect(1)  #it removes the top badge
   Label(CDU_opensession, text ="Work Order:",font = ('Arial', 12, "bold")).grid(row=1, column=0, sticky='E')
   UUT_WOopen = Entry(CDU_opensession, width=15)
   UUT_WOopen.grid(row=1, column=1)
   Button(CDU_opensession, text =" View  Report ",font = ('Arial', 12, "bold"), command = ending_session).grid(row=10, column=0, sticky='W', padx=2)
   Button(CDU_opensession, text =" Print Report ",font = ('Arial', 12, "bold"), command = ending_session).grid(row=10, column=1, sticky='W', padx=2)
   Button(CDU_opensession, text =" Send  Report ",font = ('Arial', 12, "bold"), command = ending_session).grid(row=10, column=2, sticky='W', padx=2)
   Button(CDU_opensession, text =" Return ",font = ('Arial', 12, "bold"), command = ending_session).grid(row=16, column=1, sticky='S', padx=2)

   UUT_WOopen.focus()

def test_procedure():
   CDU_test = Tk()
   CDU_test.geometry('500x268+48+225')
   CDU_test.title("CDU Acceptance Test Procedure")
# create file with name = WO number
   print("==================================================")
   print("Test Procedure")
   print("Liquid Crystal Display Control Display Unit")
   print("174101  Model 2584")
   print("ATA 34-61-14, ATLAS Test Specification 552353-10-01\n")
   Label(CDU_test, text ="    Test.1:",font = ('Arial', 14, "bold")).grid(row=0, column=0, sticky='W') 
   Label(CDU_test, text ="Power supply Test.",font = ('Arial', 14, "bold")).grid(row=0, column=1, sticky='W')
   Label(CDU_test, text ="---------------------------------------------------------------",font = ('Arial', 12, "bold")).grid(row=3, column=1, sticky='W')
   Label(CDU_test, text ="This test checks the voltages of the power",font = ('Arial', 12, "bold")).grid(row=5, column=1, sticky='W')
   Label(CDU_test, text ="supplies. The DC voltages and annunciator",font = ('Arial', 12, "bold")).grid(row=6, column=1, sticky='W')
   Label(CDU_test, text ="outputs of the power supply are sampled",font = ('Arial', 12, "bold")).grid(row=7, column=1, sticky='W')
   Label(CDU_test, text ="and converted to digital equivalent,",font = ('Arial', 12, "bold")).grid(row=8, column=1, sticky='W')
   Label(CDU_test, text ="that are output to the test station.", font = ('Arial', 12, "bold")).grid(row=9, column=1, sticky='W')
   Label(CDU_test, text ="  ",font = ('Arial', 12, "bold")).grid(row=10, column=1, sticky='W')
   Label(CDU_test, text ="  ",font = ('Arial', 12, "bold")).grid(row=11, column=1, sticky='W')
   Label(CDU_test, text ="  ",font = ('Arial', 12, "bold")).grid(row=12, column=1, sticky='W')
   Label(CDU_test, text ="  ",font = ('Arial', 12, "bold")).grid(row=13, column=1, sticky='W')


   skip = Button(CDU_test, text=" Skip ", font = ('Arial', 12, "bold"), command = donothing).grid(row=14, column=1, sticky='E', padx=2)
   print("Test Step 1 =========================\n")

   enter = Button(CDU_test, text="Enter", font = ('Arial', 12, "bold"), command = close_window).grid(row=14, column=2, sticky='W', padx=2)
   print("Test Step 2 =========================\n")

   print("Test Step 3 =========================\n")
   print("Test Step 4 =========================\n")
   print("Test Step 5 =========================\n")
   
   
def window(main):
    main.title('ATA: 34-61-14,   Liquid Crystal Display Control Display Unit')

root = Tk()
root.geometry('800x480+0+0')
root.title('Liquid Crystal Display Control Display Unit (LCDCDU)     ATA: 34-61-14')   
labelfont = ('Arial', 11, 'bold')

# Canvas =================================================================================================
canvas_width = 790
canvas_height = 470
canvas = Canvas(root,
                width=canvas_width,
                height=canvas_height)
canvas.grid(row=1, column=0, rowspan=1, columnspan=2, sticky='n')
img = PhotoImage(file="CDU.gif")
canvas.create_image(7,8, anchor=NW, image=img)
#=========================================================================================================


# Menu ===================================================================================================

menubar = Menu(root)                    #   menu bar 

sessionmenu = Menu(menubar, tearoff=0)
sessionmenu.add_command(label="New",font = ('Arial', 11, "bold"), command=new_session)
sessionmenu.add_command(label="Open",font = ('Arial', 11, "bold"), command=open_session)  
sessionmenu.add_command(label="Save",font = ('Arial', 11, "bold"), command=donothing)
sessionmenu.add_command(label="Save as...",font = ('Arial', 11, "bold"), command=donothing)
sessionmenu.add_command(label="Close",font = ('Arial', 11, "bold"), command=ending_session)
#sessionmenu.add_separator()
#sessionmenu.add_command(label="Exit", command=root.quit)
menubar.add_cascade(label="Session", font = ('Arial', 11, "bold"), menu=sessionmenu)

helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="Help Index", font = ('Arial', 11, "bold"), command=donothing)
helpmenu.add_command(label="About...", font = ('Arial', 11, "bold"), command=donothing)
menubar.add_cascade(label="Help", font = ('Arial', 11, "bold"), menu=helpmenu)


#Label(root, text="").grid(row=12, column=14, sticky='e')
#=====================================================================================================

root.config(menu=menubar)
window(root)
root.mainloop()
Reply


Messages In This Thread
tkinter - by juliolop - Sep-11-2020, 12:28 PM
RE: tkinter - by Larz60+ - Sep-11-2020, 04:41 PM
RE: tkinter - by juliolop - Sep-15-2020, 12:32 PM
RE: tkinter - by juliolop - Sep-14-2020, 07:54 PM
RE: tkinter - by Larz60+ - Sep-15-2020, 02:49 PM
RE: tkinter - by Knight18 - Sep-15-2020, 03:38 PM
RE: tkinter - by juliolop - Sep-16-2020, 01:59 PM
RE: tkinter - by juliolop - Sep-16-2020, 07:26 PM
RE: tkinter - by deanhystad - Sep-16-2020, 06:23 PM
RE: tkinter - by juliolop - Sep-16-2020, 06:37 PM
RE: tkinter - by deanhystad - Sep-16-2020, 06:53 PM
RE: tkinter - by deanhystad - Sep-17-2020, 05:06 PM
RE: tkinter - by juliolop - Sep-23-2020, 06:24 PM
RE: tkinter - by juliolop - Mar-22-2023, 07:40 PM
RE: tkinter - by deanhystad - Mar-24-2023, 03:25 AM
RE: tkinter - by juliolop - Apr-05-2023, 04:51 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020