The below is my code that works perfect when i post it to python idle and run it.
However i am having difficulty doing the following:
How do it do the following?
#1. add a screen that display the output
#2. The buttons are not scaling to the window frame, and the alignment seem to be out of array.
#tips and tricks and where can i get additional information..
use the attached link or copy and paste the below code to see how it perform in python idle:
https://trinket.io/python/ce006021fe
However i am having difficulty doing the following:
How do it do the following?
#1. add a screen that display the output
#2. The buttons are not scaling to the window frame, and the alignment seem to be out of array.
#tips and tricks and where can i get additional information..
use the attached link or copy and paste the below code to see how it perform in python idle:
https://trinket.io/python/ce006021fe
from tkinter import * import time; import tkinter.messagebox def test(): print("Test works") def raise_frame(frame): frame.tkraise() root = Tk() root.title("MESPOS") #Minimum size of the window and maximum size #Menu drop down File Edit menu = Menu(root) root.config(menu=menu) subMenu = Menu(menu) menu.add_cascade(label="File", menu=subMenu) #add stuff to drop down subMenu.add_command(label="New project", command=test) subMenu.add_command(label="New", command=test) subMenu.add_separator() subMenu.add_command(label="exit", command=test) editMenu = Menu(menu) menu.add_cascade(label="Edit", menu=editMenu) editMenu.add_command(label="Redo", command=test) editMenu.add_separator() editMenu.add_command(label="Cut", command=test) editMenu.add_command(label="Paste", command=test) topFrame = Frame(root) topFrame.pack(side=TOP, fill=X) bottomFrame = Frame(root) bottomFrame.pack(side=BOTTOM, fill=X) bottomFrame1 = Frame(root) bottomFrame1.pack(side=BOTTOM, fill=X) #toolbar toolbar =Frame(topFrame, bg="skyblue") localtime=time.asctime(time.localtime(time.time())) saleb1 = Button(toolbar, text=" Sale ", command= lambda: raise_frame(f1)).pack(side=LEFT, padx=2, pady=2) purb1 = Button(toolbar, text="Purchase", command=lambda:raise_frame(f2)).pack(side=LEFT, padx=2, pady=2) invb1 = Button(toolbar, text="Inventory", command=lambda:raise_frame(f3)).pack(side=LEFT, padx=2, pady=2) timebar = Label(toolbar, text=localtime, fg="steel blue") timebar.pack(side=RIGHT) toolbar.grid(row=1, column=0, sticky='news') #frames f1 = Frame(bottomFrame1, bg="RED") f2 = Frame(bottomFrame1, bg="blue") f3 = Frame(bottomFrame1, bg="green") f4 = Frame(bottomFrame1) for frame in (f1, f2, f3, f4): frame.grid(row=0, column=0, sticky='news') #Sales #******************PURCHASES******************************* Label(f2, text='PURCHASES').pack() topf2 = Frame(f2) topf2.pack(side=TOP, fill=X) bottomf2 = Frame(f2) bottomf2.pack(side=BOTTOM, fill=Y) # Search Sales label_21 = Label(topf2, text="Search" , bg="blue", fg="white") entry_21 = Entry(topf2) label_21.grid(row=2,column=6, sticky=E) entry_21.grid(row=2,column=5, sticky=E) #sticky right alighn the word. Button(bottomf2, text='Go to frame 3', command=lambda:raise_frame(f3)).pack() #*********************INVENTORY********************** Label(f3, text='INVENTORY 3').pack() Button(f3, text='Go to frame 4', command=lambda:raise_frame(f4)).pack(side='left') topf3 = Frame(f3) topf3.pack(side=TOP, fill=X) bottomf3 = Frame(f3) bottomf3.pack(side=BOTTOM, fill=Y) # Search Sales label_31 = Label(topf3, text="Search" , bg="blue", fg="white") entry_31 = Entry(topf3) label_31.grid(row=2,column=4, sticky=E) entry_31.grid(row=2,column=3, sticky=E) #sticky right alighn the word. #******************************************** Label(f4, text='FRAME 4').pack() Button(f4, text='Goto to frame 1', command=lambda:raise_frame(f1)).pack() toolbar.pack(side=TOP, fill=X) #******************* Sales ******************************* #canvas #label theLabel =Label(f1, text="Sales") theLabel.pack() topf1 = Frame(f1) topf1.pack(side=TOP, fill=X) bottomf1 = Frame(f1) #testing sigh =Label(bottomf1, text="SCREEN", bg="GREY", height="15", width="40") sigh.pack(side=LEFT, fill=X) bottomf1.pack(side=TOP, fill=Y) bottomf1b = Frame(f1) bottomf1b.pack(side=TOP, fill=Y) # Search Sales label_1 = Label(topf1, text="Search" , bg="blue", fg="white") entry_1 = Entry(topf1) label_1.grid(row=2,column=4, sticky=E) entry_1.grid(row=2,column=3, sticky=E) #sticky right alighn the word. #Check box check = Checkbutton(topf1, text="Taxable") check.grid(columnspan=1) # cash button button1 = Button(bottomf1b, text="Cash", width=10, height=1, fg="red", command=test) button1.pack(side=LEFT) # cheque button button2 = Button(bottomf1b, text="CHEQUE", width=10, height=1, fg="skyblue") button2.pack(side=LEFT) # Card button button3 = Button(bottomf1b, text="CARD", width=10, height=1, fg="green") button3.pack(side=LEFT, fill=X) Button(bottomf1b, text='Go to frame 2', command=lambda:raise_frame(f2)).pack() Label(f1, text='FRAME 1').pack(fill=X) #*************Status bar******************* status = Label(bottomFrame, text="connected", bd=1, relief=SUNKEN, anchor=W) status.pack(side=BOTTOM, fill=X) raise_frame(f1)