Update Widgets to be able to use grid

This commit is contained in:
Mike A. Trethewey
2020-02-21 23:47:29 -08:00
parent dbaaef662a
commit 6c9fdcd203
21 changed files with 341 additions and 602 deletions

View File

@@ -1,4 +1,4 @@
from tkinter import ttk, StringVar, Entry, Frame, Label, N, E, W, LEFT, RIGHT, X
from tkinter import ttk, StringVar, Entry, Frame, Label, N, E, W, LEFT, RIGHT, X, VERTICAL, Y
import gui.widgets as widgets
import json
import os
@@ -7,6 +7,16 @@ def custom_page(top,parent):
# Custom Item Pool
self = ttk.Frame(parent)
def create_list_frame(parent, framename):
parent.frames[framename] = Frame(parent)
parent.frames[framename].pack(side=LEFT, padx=(0,0), anchor=N)
parent.frames[framename].thisRow = 0
parent.frames[framename].thisCol = 0
def create_vertical_rule(num=1):
for i in range(0,num):
ttk.Separator(self, orient=VERTICAL).pack(side=LEFT, anchor=N, fill=Y)
def validation(P):
if str.isdigit(P) or P == "":
return True
@@ -19,51 +29,45 @@ def custom_page(top,parent):
# Custom Item Pool option sections
self.frames = {}
self.frames["itemList1"] = Frame(self)
self.frames["itemList1"].pack(side=LEFT, padx=(0,0), anchor=N)
self.frames["itemList2"] = Frame(self)
self.frames["itemList2"].pack(side=LEFT, padx=(0,0), anchor=N)
self.frames["itemList3"] = Frame(self)
self.frames["itemList3"].pack(side=LEFT, padx=(0,0), anchor=N)
self.frames["itemList4"] = Frame(self)
self.frames["itemList4"].pack(side=LEFT, padx=(0,0), anchor=N)
self.frames["itemList5"] = Frame(self)
self.frames["itemList5"].pack(side=LEFT, padx=(0,0), anchor=N)
create_list_frame(self,"itemList1")
create_vertical_rule(2)
create_list_frame(self,"itemList2")
create_vertical_rule(2)
create_list_frame(self,"itemList3")
create_vertical_rule(2)
create_list_frame(self,"itemList4")
create_vertical_rule(2)
create_list_frame(self,"itemList5")
with open(os.path.join("resources","app","gui","custom","overview","itemList1.json")) as items:
myDict = json.load(items)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["itemList1"])
for key in dictWidgets:
self.customWidgets[key] = dictWidgets[key]
self.customWidgets[key].pack()
with open(os.path.join("resources","app","gui","custom","overview","itemList2.json")) as items:
myDict = json.load(items)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["itemList2"])
for key in dictWidgets:
self.customWidgets[key] = dictWidgets[key]
self.customWidgets[key].pack()
with open(os.path.join("resources","app","gui","custom","overview","itemList3.json")) as items:
myDict = json.load(items)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["itemList3"])
for key in dictWidgets:
self.customWidgets[key] = dictWidgets[key]
self.customWidgets[key].pack()
with open(os.path.join("resources","app","gui","custom","overview","itemList4.json")) as items:
myDict = json.load(items)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["itemList4"])
for key in dictWidgets:
self.customWidgets[key] = dictWidgets[key]
self.customWidgets[key].pack()
with open(os.path.join("resources","app","gui","custom","overview","itemList5.json")) as items:
myDict = json.load(items)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["itemList5"])
for key in dictWidgets:
self.customWidgets[key] = dictWidgets[key]
self.customWidgets[key].pack()
keys = list(self.customWidgets.keys())
for i in range(0, len(keys)):