Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UsersDetailsEditPage(Tk):
- def __init__(self, *args, **kwargs):
- Tk.__init__(self, *args, **kwargs)
- self.title("Edit User Details")
- self.option_add("*Font", 'TkDefaultFont')
- self.noteBook = ttk.Notebook(self)
- for i in range(len(users)):
- self.noteBook.add(self.getUserViewFrame(users[i]), text=users[i][2])
- self.noteBook.pack()
- self.resizable(width=False, height=False)
- def getUserViewFrame(self, user):
- frame = Frame(self)
- frame.grid_rowconfigure(1, weight=1)
- frame.grid_columnconfigure(1, weight=1)
- Label(frame, text="User's name:").grid(row=0, column=0, sticky=W)
- nameText = Text(frame, height=1, width=20)
- nameText.insert("1.0", user[2])
- nameText.edit_reset()
- nameText.grid(row=0, column=1, sticky=E)
- Label(frame, text="Username:").grid(row=1, column=0, sticky=W)
- usernameText = Text(frame, height=1, width=20)
- usernameText.insert("1.0", user[0])
- usernameText.edit_reset()
- usernameText.grid(row=1, column=1, sticky=E)
- Label(frame, text="Password:").grid(row=2, column=0, sticky=W)
- passwordText = Text(frame, height=1, width=20)
- passwordText.insert("1.0", user[1])
- passwordText.edit_reset()
- passwordText.grid(row=2, column=1, sticky=E)
- # the constructor syntax is:
- # OptionMenu(master, variable, *values)
- Label(frame, text="User Access:").grid(row=3, column=0, sticky=W)
- self.options = StringVar()
- self.options.set("User")
- self.userAccessDrop = ttk.OptionMenu(frame, self.options, "User", *("User", "Admin"))
- self.userAccessDrop.config(width=10)
- self.userAccessDrop.grid(row=3, column=1, sticky=E)
- return frame
- from tkinter import *
- from tkinter import messagebox
- import tkinter.ttk as ttk
- import csv
- import os
- frame.options = StringVar()
- frame.options.set("User")
- frame.userAccessDrop = ttk.OptionMenu(frame, frame.options, "User", *("User", "Admin"))
- frame.userAccessDrop.config(width=10)
- frame.userAccessDrop.grid(row=3, column=1, sticky=E)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement