Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 need hep with entry
why the option Retrieve Report in this code does not record a number in the variable WO-rep after enter it.? like WO entry does.

#imports ===========================================================================================
from tkinter import *
from tkinter import ttk
import tkinter as tk
import tkinter.messagebox
from tkinter.messagebox import showinfo
from Test_1 import *
from Test_2 import *
from Test_3 import *
from Test_4 import *
from Test_5 import *
from Test_6 import *
from view_report import *
from save_USB import *
from print_report import *
from help_window import *
from about_window import *
from fail_database import *
from FAQ_window import *
from Exit_ATP import *
from ending_session import *
import os, time

# Create instance
CDU = tk.Tk()

def window(CDU):
   CDU.title('ATA: 34-61-14,   Liquid Crystal Display Control Display Unit')
   CDU.wm_attributes('-type', 'splash')
   CDU.resizable(False,False)       # prevent the GUI from being resizable, the same for (0,0)
   f = open("report.rep",'a+')
def donothing():
   print("ok, ok I won't")     

def about():
   showinfo(title='About', message='Application developed in Python with Tkinter by AQS\nAny problem or suggestion, please contact (941) 726-6632')   

def start_progressbar():

def stop_progressbar():

def ending_session():

#   print("Work Order: %s\n" % (UUT_wo.get()))   
   os.rename('report.rep','%s.rep' % (UUT_wo.get()))
#   os.execv('//media/pi/ROOT/', [''])

def run_progressbar():
   progress_bar["maximum"] = 100
   for i in range [101]:
         progress_bar["value"] = i          #increment progressbar
         progress_bar.update()              #have to call update() in loop
   progress_bar["value"] = 0                #reset / clear progressbar  

def retrieve_report():
   Label(CDU, text="WO Report:",font = ('Arial', 13, "bold"), fg = 'darkblue').grid(row=12, column=3, sticky='e')
   WO_rep = tk.Entry(CDU, width=30)
   WO_rep.grid(row=12, column=4, sticky='w')
   print("WO: %s\n" % (UUT_wo.get()))
   print("WO Retrieve: %s\n" % (WO_rep.get()))

def test_procedure():
   atp = tk.Tk()
   menubar = Menu(atp)
   def exit_ATP():
       f = open('report.rep','a')
       f.write("Closing session\n")
       d =
       f.write("                      ...Bye\n")
   def complete_test():
      print ("Complete Test!")
      f = open("report.rep",'a')
      f.write("Developing All Tests\n")

   # create a pulldown menu, and add it to the menu bar
   atpmenu = Menu(menubar, tearoff=0)
   atpmenu.add_command(label="Complete test", command=complete_test)

   stepsmenu = Menu(atpmenu, tearoff=0)
   stepsmenu.add_command(label="Test No1", command=Test_1)
   stepsmenu.add_command(label="Test No2", command=Test_2)
   stepsmenu.add_command(label="Test No3", command=Test_3)
   stepsmenu.add_command(label="Test No4", command=Test_4)
   stepsmenu.add_command(label="Test No5", command=Test_5)
   stepsmenu.add_command(label="Test No6", command=Test_6)
   atpmenu.add_cascade(label="Step by step", menu=stepsmenu) 
   atpmenu.add_command(label="Exit", command=exit_ATP)   
   menubar.add_cascade(label="Test Procedure", menu=atpmenu)

   reportmenu = Menu(menubar, tearoff=0)
   reportmenu.add_command(label="View (display)", command=view_report)
   reportmenu.add_command(label="Save to USB", command=save_USB)   
   reportmenu.add_command(label="Print...", command=print_report)   
   menubar.add_cascade(label="Reports", menu=reportmenu)

   helpmenu = Menu(menubar, tearoff=0)
   helpmenu.add_command(label="Help...", command=help_window) 
   helpmenu.add_command(label="FAQ", command=FAQ_window) 
   helpmenu.add_command(label="Failures database", command=fail_database)
   helpmenu.add_command(label="About...", command=about_window)   
   menubar.add_cascade(label="Help", menu=helpmenu)
   # display the menu
   print("Work Order: %s\nUUT_PN: %s\nUUT SN:%s\nTechnician:%s" % (UUT_wo.get(), UUT_pn.get(), UUT_sn.get(), WO_tech.get()))
   if radVar.get() == 1: print ("Work Requested: Bench Check")
   elif radVar.get() == 2: print ("Work Requested: Repair")
   elif radVar.get() == 3: print ("Work Requested: Overhaul")
   print("Acceptance Test Procedure")
   print("Liquid Crystal Display Control Display Unit")
   print("174101  Model 2584")
   print("ATA 34-61-14, ATLAS Test Specification 552353-10-01")
   from datetime import datetime
   d =
   print("{:%Y-%m-%d %H:%M:%S}".format(d))

   f = open("report.rep",'a')
   f.write("Acceptance Test Procedure\n")
   f.write("Liquid Crystal Display Control Display Unit\n")
   f.write("174101  Model 2584\n")
   f.write("ATA 34-61-14, ATLAS Test Specification 552353-10-01\n")
   f.write("{:%m-%d-%Y %H:%M:%S}\n".format(d))
   f.write('WO:'+ UUT_wo.get())
   f.write("\nUUT_PN: %s\nUUT SN:%s\nTechnician:%s" % (UUT_pn.get(), UUT_sn.get(), WO_tech.get()))
   f = open("report.rep",'a')

# Add a title, size and disabling resize
CDU.attributes('-type', 'dock')
CDU.title('ATA: 34-61-14,   Liquid Crystal Display Control Display Unit')

# Adding Labels and Entries widgets =======================================================================
Label(CDU, text="UUT PN:",font = ('Arial', 16,"bold"), fg = 'darkblue').grid(row=1, column=3, sticky='e')
Label(CDU, text="Work Order:",font = ('Arial', 16, "bold"), fg = 'darkblue').grid(row=2, column=3, sticky='e')
Label(CDU, text="UUT SN:",font = ('Arial', 16, "bold"), fg = 'darkblue').grid(row=3, column=3, sticky='e')
Label(CDU, text="Technician:",font = ('Arial', 16, "bold"), fg = 'darkblue').grid(row=5, column=3, sticky='e')

UUT_pn = tk.Entry(CDU, width=30)
UUT_wo = tk.Entry(CDU, width=30)
UUT_sn = tk.Entry(CDU, width=30)
WO_tech = tk.Entry(CDU, width=18)
#WO_retrieve = tk.Entry(CDU, width=30)

UUT_pn.grid(row=1, column=4, sticky='e')
UUT_wo.grid(row=2, column=4, sticky='e')
UUT_sn.grid(row=3, column=4, sticky='e')
WO_tech.grid(row=5, column=4, sticky='w')


# Radiobuttons ===========================================================================================
# Radiobuttons Callback
def radCall():
    if radSel == 1: CDU.configure()
    elif radSel == 2: CDU.configure()
    elif radSel == 3: CDU.configure()
# Create three Radiobuttons using one variable
radVar = IntVar() 
Label(CDU, text="Work Requested:",font = ('Arial', 16, "bold"), fg = 'darkblue'). grid(row=7, column=3, sticky='w')
benchtest = Radiobutton(CDU, text="Bench Test", font = ('Arial', 16, "bold"),variable=radVar, value=1, command=radCall)
benchtest.grid(row=7, column=4, columnspan=2, sticky='w')
repair = Radiobutton(CDU, text="Repair", font = ('Arial', 16, "bold"), variable=radVar, value=2, command=radCall)
repair.grid(row=8, column=4, columnspan=2, sticky='w')
overhaul = Radiobutton(CDU, text="Overhaul", font = ('Arial', 16, "bold"), variable=radVar, value=3, command=radCall)
overhaul.grid(row=9, column=4, columnspan=4, sticky='w')

# Canvas =================================================================================================
canvas_width = 291
canvas_height =387 
canvas = Canvas(CDU,
canvas.grid(row=1, column=0, rowspan=11, columnspan=2, sticky='n')
img = PhotoImage(file="174101_2.gif")
canvas.create_image(20,20, anchor=NW, image=img)

Label(CDU, text="").grid(row=12, column=18, sticky='e')

# Functions ===============================================================================================
Button(CDU, text="   Test Procedure    ",font = ('Arial', 16, "bold"), command = test_procedure).grid(row=10, column=4, sticky='e', padx=2)
Button(CDU, text=" Retrieve Report ",font = ('Arial', 16, "bold"), command = retrieve_report).grid(row=12, column=1, sticky='e')
Button(CDU, text=" About...",font = ('Arial', 16, "bold"), command = about).grid(row=15, column=1, sticky='e', padx=2)
Button(CDU, text=" Close Session ",font = ('Arial', 16, "bold"), command = ending_session).grid(row=15, column=4, sticky='e', padx=2)


#Start GUI
CDU.mainloop( ) 

Where's the WO entry, so I can see your code that you say is working? Or could you maybe simplify the code to just 10ish lines demonstrating the issue? I don't want to have to try to pour through 235 lines of poorly written code to try to figure out where the problem might be.
There are other errors. Like progress_bar has not been declared that I can see, you import tkinter more than once, and you have more than one Tk() instance. And does contain a function or class also named Test_1? If not, you will have problems there as well. Looks like some testing and organization are in order.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] how to input a random entry with each button press? nadavrock 1 129 Jun-17-2019, 05:28 AM
Last Post: Yoriz
  [Tkinter] getting Entry text Stauricus 4 209 May-10-2019, 08:24 PM
Last Post: swanysto
  [Tkinter] Not getting entry values on button click & treeview not updating ? swanysto 4 271 May-10-2019, 04:16 PM
Last Post: swanysto
  [Tkinter] how to get the entry information using Entry.get() ? SamyPyth 2 290 Mar-18-2019, 05:36 PM
Last Post: woooee
  Update plot by <Return> bind with entry widget Zorro 1 274 Mar-09-2019, 12:27 PM
Last Post: Zorro
  [WxPython] bind label and entry text with return key metulburr 1 499 Aug-14-2018, 10:02 PM
Last Post: metulburr
  [Tkinter] Tkinter Entry widget and KeyPad intrgration chiragarya1992 0 700 Aug-11-2018, 01:09 AM
Last Post: chiragarya1992
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 1 3,441 Jul-16-2018, 09:06 AM
Last Post: Larz60+
  [Tkinter] How to restrict characters used in an Entry widget? Nwb 2 1,764 Jun-20-2018, 12:55 PM
Last Post: Nwb
  [Tkinter] How to use .get() for Entry? Nwb 4 901 Jun-18-2018, 02:20 PM
Last Post: nilamo

Forum Jump:

Users browsing this thread: 1 Guest(s)