Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter
- import tkinter.font
- from tkinter import ttk
- import csv
- from csv import DictReader
- import sys
- import os
- import subprocess
- tree_columns = ("Drawing", "Issue", "Document type")
- class TFPP:
- def __init__(self):
- self.tree = None
- self._setup_widgets()
- self._build_tree()
- self._clear_text()
- def _setup_widgets(self):
- #this is the setup & layout for the top part of the application i.e. the textbox and buttons.
- frame1=ttk.Frame()
- frame1.pack(fill='both', expand=False)
- AmpicsLabel = ttk.Label(frame1,justify="left", anchor="s", text=("Ampics Number :"))
- SOentry=ttk.Entry(frame1,justify="left", width=15)#, sonumber)
- Searchbutton = ttk.Button(frame1,text="Search")#, command='do_a_search')
- AmpicsLabel.pack(side="left", padx=5)
- SOentry.pack(side="left", padx=5)
- Searchbutton.pack(side="right", padx=3, pady=1)
- frame2=ttk.Frame()
- frame2.pack(fill='both', expand=False)
- DescLabel = ttk.Label(frame2,justify="left", anchor="sw", text=("Part Description : "))
- PartDesc = ttk.Entry(frame2,justify="left", width=57)
- Resetbutton = ttk.Button(frame2,text="Reset", command=self._clear_text)
- DescLabel.pack(side="left", padx=5)
- PartDesc.pack(side="left", padx=5,pady=5)
- Resetbutton.pack(side="right", padx=3, pady=1)
- frame3=ttk.Frame()
- frame3.pack(fill='both', expand=False)
- Quitbutton = ttk.Button(frame3,text="Quit", command=app.destroy)
- Quitbutton.pack(side="right", padx=3, pady=1)
- # this is the setup & layout for the drawing list part.
- container = ttk.Frame()
- container.pack(fill='both', expand=False)
- self.tree = ttk.Treeview(columns=tree_columns, show="headings")
- vsb = ttk.Scrollbar(orient="vertical", command=self.tree.yview)
- self.tree.grid(column=0, row=0, sticky='nsew', in_=container)
- vsb.grid(column=1, row=0, sticky='ns', in_=container)
- container.grid_columnconfigure(0, weight=1)
- container.grid_rowconfigure(0, weight=1)
- def _build_tree(self):
- for col in tree_columns:
- self.tree.heading(col, text=col.title(),
- command=lambda c=col: sortby(self.tree, c, 0))
- self.tree.column("Drawing",width=120,anchor="center", stretch="no")
- self.tree.column("Issue",width=75, anchor="center", stretch="no")
- self.tree.column("Document type",anchor="w",width=300)
- self.treeview=self.tree
- def _clear_text(self):
- PartDesc.delete(0, end)
- if __name__ == "__main__":
- app = tkinter.Tk()
- app.title("Production Drawings")
- app.geometry("550x330")
- tfpp = TFPP()
- app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement