def main(): global view,labelNum, buttonStart, buttonStop app = MainApp() buttonStart = Button("Start", action = start_task) buttonStop = Button("Stop", action = stop_task) splitSpace = 30 labelNum = make_label("0", just = 'center', color=red, width=buttonStart.width*2 + splitSpace); labelNumCaption = make_label("Num:", just = 'center', color=red, width=buttonStart.width); # set positions for the buttons and labels buttonStart.position = (20, 20); buttonStop.position = (20 + buttonStart.width + splitSpace, 20); labelNum.position = (20, 0) labelNumCaption.position = (20, 0) # create new window and dynamic linechart view view = DynLineChartView(width=polyViewWidth, height=polyViewHeight) view.left = buttonStart.left view.top = buttonStart.top + buttonStart.height + 5 win = MainWindow(title = windowTitle) # custized layouts windowWidth= 20 + polyViewWidth windowHeight= 210 win.size = (windowWidth, windowHeight) # add controls win.add(labelNum); win.add(labelNumCaption); win.add(buttonStart); win.add(buttonStop); # add DynLineChart view win.add(view); win.menus = app_menus # enabled on/off enableButtons(False) # show window win.show() app.run()
def initializeImages(self, parent): self.images = [] self.imageNames = [] skins = [file for file in os.listdir(os.path.join("Data", "Pics", "Actors")) if file[len(file) - 4:].upper() == ".PNG"] for skin in skins: self.images += [Image(file = os.path.join("Data", "Pics", "Actors", skin))] self.imageNames += [skin] btn = Button(title = "Back", action = self.backClicked, style = 'default') btn.position = ((self.width - btn.width) / 2, self.height - btn.height - 10) self.add(btn)
def __init__(self, **kwds): Window.__init__(self, **kwds) view = TestScrollableView(container = self, size = (300, 300), extent = (1000, 1000), scrolling = 'hv', anchor = 'ltrb') button = Button("Embedded", action = self.click) off = (300, 300) view.scroll_offset = off button.position = off view.add(button) self.shrink_wrap()
def __init__(self, **kwds): Window.__init__(self, **kwds) view = TestScrollableView(container=self, size=(300, 300), extent=(1000, 1000), scrolling='hv', anchor='ltrb') button = Button("Embedded", action=self.click) off = (300, 300) view.scroll_offset = off button.position = off view.add(button) self.shrink_wrap()
def initializeImages(self, parent): self.images = [] self.imageNames = [] skins = [ file for file in os.listdir(os.path.join("Data", "Pics", "Actors")) if file[len(file) - 4:].upper() == ".PNG" ] for skin in skins: self.images += [ Image(file=os.path.join("Data", "Pics", "Actors", skin)) ] self.imageNames += [skin] btn = Button(title="Back", action=self.backClicked, style='default') btn.position = ((self.width - btn.width) / 2, self.height - btn.height - 10) self.add(btn)
from GUI import View, Button, FileDialogs, Label, Font
from GUI import View, Button, Image