def main(alljobs, stagelist): #print (x) print ('-') print (alljobs[0]) stage = stagelist[0] #stage = 'ced' print ('-'*70) weeks = current_delivery(alljobs, stage) #for week in weeks: # print (week['title']) # for job in week['jobs']: # print (job['jobname']) title = GLabel('Title', width=300, height=20, text='Latest CRC Jobs') header = GFrame_Row('Header', [title], height = 40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]]) footer = GFrame_Row('Footer',[exit_button], height=40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]]) stagelabel = GLabel('Title', width=100, height=20, text=stage) stagerow = GFrame_Row('StageRow',[stagelabel], height=40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]]) # Create stage selection button cedbutton = GButton('GetCED', width=100, height=30, text='CED') initialbutton = GButton('GetInitial', width=100, height=30, text='Initial') secondpagesbutton = GButton('SecondPages', width=100, height=30, text='Second Pages') finalpagesbutton = GButton('FinalPages', width=100, height=30, text='Final Pages') sbutton = GFrame_Row('SButtonRow',[cedbutton, initialbutton, secondpagesbutton, finalpagesbutton], height=40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]]) widgets = [header, sbutton, stagerow] # Create table for i, week in enumerate(weeks): tb = create_stuff(i, week) widgets.append(tb) widgets.append(footer) con3 = HBox('MainBox', widgets) root = TK.Tk() g = con3 build_gui(root, g) status = ['quit'] exit_button.set_command(root.destroy) cedbutton.set_command(lambda: clicked(root, status, 'ced') ) initialbutton.set_command(lambda: clicked(root, status, 'initial') ) secondpagesbutton.set_command(lambda: clicked(root, status, '2ndpages') ) finalpagesbutton.set_command(lambda: clicked(root, status, 'finalpages') ) title.widget.configure(foreground="black", font='arial 14 bold', background='white') stagelabel.widget.configure(foreground="black", font='arial 12 bold', background='white') root.mainloop() # Now which button was pressed? return status
def create_stage_table(i, week): weektitle = GLabel('WeekTitle' + str(i), width=300, height=20) weektitle.set_text(week['title']) if week['jobs']: tb = crc_duedatetable(week['jobs']) b = VBox('Box1' + str(i), [tb]) return HBox('Box2' + str(i), [weektitle, b]) else: return weektitle
def __init__(self): # Initialise database self.children = {} alljobs = get_crc_all_jobs() self.job_recs = alljobs self.root = TK.Tk() title = GLabel('Title', width=300, height=20, text='AMCAT') header = GFrame_Row('Header', [title], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]]) tb = crc_newjobstable(self.job_recs) newjobs = HBox('Box1', [tb]) # Add buttons on the left duedatetitle = GLabel('DueDateTitle', width=100, height=30, text='Due Dates') self.ced_button = GButton('CED', width=100, height=30, text='CED') self.ced_button.set_command(lambda: self.create_stage('ced')) b2 = GButton('Initial', width=100, height=30, text='Initial') b2.set_command(lambda: self.create_stage('initial')) b3 = GButton('2ndPages', width=100, height=30, text='2nd Pages') b3.set_command(lambda: self.create_stage('2ndpages')) b4 = GButton('FinalPages', width=100, height=30, text='Final Pages') b4.set_command(lambda: self.create_stage('finalpages')) duedatebuttons = GFrame_Column( 'DueDateButtons', [duedatetitle, self.ced_button, b2, b3, b4], width=140, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0, 0]]) centerbox = VBox('CenterBox', [duedatebuttons, newjobs]) footer = create_footer(self.root) widgets = [header, centerbox, footer] self.mainbox = HBox('MainBox', widgets) build_gui(self.root, self.mainbox) title.widget.configure(foreground="black", font='arial 14 bold', background='white') duedatetitle.widget.configure(foreground="black", font='arial 12 bold', background='white') self.root.mainloop()
def create_stuff(i, week): weektitle = GLabel('WeekTitle' + str(i), width=300, height=20) weektitle.set_text(week['title']) if week['jobs']: wrow = GFrame_Row('WRow'+str(i), [weektitle], height = 40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]]) tb = crc_table(week['jobs']) b = VBox('Box1'+str(i), [tb]) return HBox('Box2'+str(i), [weektitle, b]) else: return weektitle
def create_stage_window(self, stage): stagelabel = GLabel(stage + 'StageTitle', width=100, height=20, text=stage) stagerow = GFrame_Row(stage + 'StageRow', [stagelabel], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]]) stagerow.configure(background='black') # Create table widgets = [stagerow] weeks = current_delivery(self.job_recs, stage) for i, week in enumerate(weeks): tb = create_stage_table(i, week) widgets.append(tb) stage_window = HBox(stage + 'MainBox', widgets) # Position Topwindow right of buttons x, y = self.ced_button.get_absolute_x_y() x += self.ced_button.width + 10 build_gui(None, stage_window, xpos=x) #stagerow.widget.configure(background='black') return stage_window
# Create the widgets for the sample from widgetnode import GLabel, GButton label1 = GLabel('Label1', width=100, height=20) label2 = GLabel('Label2', width=100, height=20) label3 = GLabel('Label3', width=100, height=20) label4 = GLabel('Label4', width=100, height=30) button1 = GButton('Button1', width=100, height=30) button2 = GButton('Button2', width=100, height=30) button3 = GButton('Button3', width=100, height=30) exit_button = GButton('ExitButton', text='Quit', width=100, height=30)
import tkinter as TK from widgetnode import GLabel, GButton from containernode import GFrame_Row, GFrame_Column, HBox, VBox from constants import WIN, HIN, VT, HL, VC, VB, HAS, HC, WEX from build import build_gui root = TK.Tk() t = GLabel('Title', width=300, height=20, text = 'AMCAT') header = GFrame_Row('Header', [t], parms=[WIN, HIN, HC, VC,[10,10], [15,15]]) b1 = GButton('Save', width=100, height=30, text='Save') b1.set_command(root.destroy) b2 = GButton('Cancel', width=100, height=30, text='Cancel') footer = GFrame_Row('RowFooter',[b1, b2], height=40, parms=[WIN, HIN, HC, VC,[10,5,10], [0,0]]) main_container = HBox('main', [header,footer]) build_gui(root, main_container) root.mainloop()
import tkinter as TK from tkinter import ttk from pymongo import MongoClient from widgetnode import GLabel, GButton mongo = MongoClient('localhost', 27017) db = mongo.Production jobs = db.Jobs job_recs = jobs.find({"company": 'MTC', "customer": 'CRC'}) x = list(job_recs) x = sorted(x, key=lambda y: y['received'], reverse=True) #print (x) print('-') print(x[0]) title = GLabel('Title', width=300, height=20) title.set_text('Latest CRC Jobs') header = GFrame_Row('Header', [title], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]]) tb = crc_table(x) con1 = VBox('Box1', [tb]) con2 = GFrame_Row('Row4', [exit_button], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]]) con3 = HBox('Box2', [header, con1, con2]) root = TK.Tk()