Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. import tkinter
  2. import tkinter.font
  3. from tkinter import ttk
  4. import csv
  5. from csv import DictReader
  6. import sys
  7. import os
  8. import subprocess
  9.  
  10. tree_columns = ("Drawing", "Issue", "Document type")
  11.  
  12. class TFPP:
  13.  
  14. def __init__(self):
  15. self.tree = None
  16. self._setup_widgets()
  17. self._build_tree()
  18. self._clear_text()
  19.  
  20.  
  21. def _setup_widgets(self):
  22. #this is the setup & layout for the top part of the application i.e. the textbox and buttons.
  23. frame1=ttk.Frame()
  24. frame1.pack(fill='both', expand=False)
  25. AmpicsLabel = ttk.Label(frame1,justify="left", anchor="s", text=("Ampics Number :"))
  26. SOentry=ttk.Entry(frame1,justify="left", width=15)#, sonumber)
  27. Searchbutton = ttk.Button(frame1,text="Search")#, command='do_a_search')
  28. AmpicsLabel.pack(side="left", padx=5)
  29. SOentry.pack(side="left", padx=5)
  30. Searchbutton.pack(side="right", padx=3, pady=1)
  31.  
  32. frame2=ttk.Frame()
  33. frame2.pack(fill='both', expand=False)
  34. DescLabel = ttk.Label(frame2,justify="left", anchor="sw", text=("Part Description : "))
  35. PartDesc = ttk.Entry(frame2,justify="left", width=57)
  36. Resetbutton = ttk.Button(frame2,text="Reset", command=self._clear_text)
  37.  
  38. DescLabel.pack(side="left", padx=5)
  39. PartDesc.pack(side="left", padx=5,pady=5)
  40. Resetbutton.pack(side="right", padx=3, pady=1)
  41.  
  42. frame3=ttk.Frame()
  43. frame3.pack(fill='both', expand=False)
  44. Quitbutton = ttk.Button(frame3,text="Quit", command=app.destroy)
  45. Quitbutton.pack(side="right", padx=3, pady=1)
  46.  
  47. # this is the setup & layout for the drawing list part.
  48. container = ttk.Frame()
  49. container.pack(fill='both', expand=False)
  50. self.tree = ttk.Treeview(columns=tree_columns, show="headings")
  51. vsb = ttk.Scrollbar(orient="vertical", command=self.tree.yview)
  52. self.tree.grid(column=0, row=0, sticky='nsew', in_=container)
  53. vsb.grid(column=1, row=0, sticky='ns', in_=container)
  54. container.grid_columnconfigure(0, weight=1)
  55. container.grid_rowconfigure(0, weight=1)
  56.  
  57.  
  58. def _build_tree(self):
  59. for col in tree_columns:
  60. self.tree.heading(col, text=col.title(),
  61. command=lambda c=col: sortby(self.tree, c, 0))
  62.  
  63. self.tree.column("Drawing",width=120,anchor="center", stretch="no")
  64. self.tree.column("Issue",width=75, anchor="center", stretch="no")
  65. self.tree.column("Document type",anchor="w",width=300)
  66. self.treeview=self.tree
  67.  
  68. def _clear_text(self):
  69. PartDesc.delete(0, end)
  70.  
  71. if __name__ == "__main__":
  72. app = tkinter.Tk()
  73. app.title("Production Drawings")
  74. app.geometry("550x330")
  75. tfpp = TFPP()
  76. app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement