Guest User

Untitled

a guest
Oct 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. from tkinter import *
  2. from tkinter.ttk import *
  3.  
  4. import datetime
  5. vandaag = datetime.datetime.today()
  6. s = vandaag.strftime(" %H:%M ")
  7.  
  8. root = Tk()
  9. root.configure(background='gold')
  10. frame1 = Frame(master=root)
  11. frame1.place(x = 206, y = 166)
  12.  
  13. def clicked():
  14. tekst = s
  15. label1["text"] = tekst
  16.  
  17. zero = 0
  18. counter = 0
  19. def laadtabel():
  20. global counter
  21. if counter == 1:
  22. frame1.destroy()
  23. counter = 0
  24. else:
  25. counter = 1
  26. class App(Frame):
  27.  
  28. def __init__(self, parent):
  29. Frame.__init__(self, parent)
  30. self.CreateUI()
  31. self.LoadTable()
  32. self.grid(sticky = (N,S,W,E))
  33. parent.grid_rowconfigure(0, weight = 1)
  34. parent.grid_columnconfigure(0, weight = 1)
  35.  
  36. def CreateUI(self):
  37. tv = Treeview(self)
  38. tv['columns'] = ('vertrek', 'bestemming', 'spoor')
  39. tv.heading("#0", text='Soort trein', anchor='w')
  40. tv.column("#0", anchor="w")
  41. tv.heading('vertrek', text='Vertrek')
  42. tv.column('vertrek', anchor='center', width=100)
  43. tv.heading('bestemming', text='Bestemming')
  44. tv.column('bestemming', anchor='center', width=100)
  45. tv.heading('spoor', text='Spoor')
  46. tv.column('spoor', anchor='center', width=100)
  47. tv.grid(sticky = (N,S,W,E))
  48. self.treeview = tv
  49. self.grid_rowconfigure(0, weight = 1)
  50. self.grid_columnconfigure(0, weight = 1)
  51.  
  52. def LoadTable(self):
  53. self.treeview.insert('', 'end', text="Sprinter", values=('10:00',
  54. 'Uitgeest', '2'))
  55.  
  56. def main():
  57. App(frame1)
  58.  
  59. if __name__ == '__main__':
  60. main()
  61.  
  62.  
  63.  
  64. from tkinter import Button
  65. labeltijd = Label(master=root,
  66. text=s, background="gold", foreground="white", font=("calibribold", 35))
  67. labeltijd.place(x = 4, y = 96)
  68.  
  69. labelbovenaan = Label(master=root,
  70. text="Vertrektijden ", background="white", foreground="navy", font=("calibribold", 30))
  71. labelbovenaan.place(x=0, y=0)
  72.  
  73. labelbanner = Label(master = root, text = "Tijd ", background = "navy", foreground = "white", font=("bold", 14))
  74. labelbanner.place(x = 4, y = 64)
  75.  
  76. labelbanner2 = Label(master = root, text = "Plan uw reis ", background = "navy", foreground = "white", font=("bold", 14))
  77. labelbanner2.place(x = 206, y = 64)
  78.  
  79. button1 = Button(master=root, text='Veenendaal West', foreground="white", background='navy', width=25, height=2, font=("bold", 14), command = laadtabel)
  80. button1.place(x = 206, y = 96)
  81.  
  82. button2 = Button(master=root, text='Veenendaal Centrum', background="navy", foreground="white", width=25, height=2, font = ("bold", 14), command = laadtabel)
  83. button2.place(x = 494, y = 96)
  84.  
  85. root.geometry("1000x400")
  86. root.mainloop()
Add Comment
Please, Sign In to add comment