Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter.ttk import Notebook
- N = 25
- class IterEntryField:
- def __init__(self, frame, label):
- self.frame = frame
- self.label = label
- def pack(self):
- self.valLabel = Label(self.frame, text = self.label, anchor = 'w')
- self.valLabel.pack(side = LEFT)
- self.variable = StringVar()
- self.variable.set('0')
- self.valEntry = Entry(self.frame, textvariable = self.variable)
- self.valEntry.pack(side = RIGHT)
- def notebookpopup():
- zSetupWindow = Toplevel(root)
- zSetupWindow.geometry('{}x{}'.format(800, 300))
- notebook = Notebook(zSetupWindow)
- evspace = Frame(notebook)
- notebook.add(evspace, text = "Evenly spaced values")
- sOverflow = Label(evspace, text = 'Ignore this')
- sOverflow.pack()
- uevspace = Frame(notebook)
- notebook.add(uevspace, text = "Individual values")
- canvas = Canvas(uevspace)
- vsb = Scrollbar(canvas, command=canvas.yview)
- canvas.config(yscrollcommand = vsb.set)
- canvas.pack(side = LEFT, fill = BOTH, expand = True)
- vsb.pack(side = RIGHT, fill = Y, expand = True)
- entryContainer = Frame(canvas)
- entryContainer.pack(expand = True)
- frameDict = {}
- for i in range(0, N):
- frameDict[i] = Frame(entryContainer)
- frameDict[i].pack()
- entry = IterEntryField(frameDict[i], 'Z value for subfile {}'.format(i+1))
- entry.pack()
- canvas.create_window(0, 0, window = entryContainer, anchor = 'nw')
- root.update()
- print()
- canvas.config(scrollregion = canvas.bbox('all'))
- notebook.pack(fill = BOTH, expand = True)
- root = Tk()
- button = Button(root, text = 'new window', command = notebookpopup)
- button.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement