table.add_column("ID", 30, "CustomerID") self.dynaset.buttonOK = pylax.Button(self.window, -60, -50, 40, 20, "OK") self.dynaset.buttonOK.on_click = self.buttonOK__on_click; self.dynaset.execute({"Name": self.entrySearch.data}, self.query_browse) self.window.wait_for_close() def buttonSearch__on_click(self, buttonSearch): text = self.entrySearch.data r = self.dynaset.execute({"Name": text if len(text) > 0 else "%"}, self.query_browse) def buttonOK__on_click(self, buttonOK): self.ok = True self.window.close() sayHelloMenuItem = pylax.MenuItem("Say Hello", sayHelloMenuItem__on_click) pylax.append_menu_item(sayHelloMenuItem) aboutBoxMenuItem = pylax.MenuItem("About...", aboutBoxMenuItem__on_click) pylax.append_menu_item(aboutBoxMenuItem) ds = pylax.Dynaset("Item", "SELECT ItemID, Name, Description, Picture, Price FROM Item WHERE Item.Name LIKE :Name ORDER BY Name DESC LIMIT 100;") ds.autoColumn = ds.add_column("ItemID", int, format="{:,}", key=True) # part of primary key ds.add_column("Name", default = "Another One") ds.add_column("Description", str) ds.add_column("Picture", bytes) ds.add_column("Price", float) dsDetail = pylax.Dynaset("ItemSold", "SELECT ItemSold.rowid, Item, Customer, Customer.Name AS CustomerName, Quantity FROM ItemSold JOIN Customer ON ItemSold.Customer=Customer.CustomerID WHERE ItemSold.Item=:ItemID LIMIT 100;", parent=ds) dsDetail.autoColumn = dsDetail.add_column("rowid", int, key=True) dsDetail.add_column("Item", int, parent = "ItemID") dsDetail.add_column("Customer", int)
penDown = False if e[0] != None: for i in range(canvasWidth): x = graphX(i + 1) try: y = eval(e[0]) yC = canvasY(y) except: yC = -1 if yC < 0 or yC > canvasHeight: penDown = False else: if penDown: canvas.line_to(i, yC) else: canvas.move_to(i, yC) penDown = True def executeButton__on_click(data): canvas.repaint() canvas.on_paint = canvas__on_paint executeButton.on_click = executeButton__on_click newWindowMenuItem = pylax.MenuItem("New Window", newWindowMenuItem__on_click) pylax.append_menu_item(newWindowMenuItem) newWindowMenuItem__on_click()
import Item import LegalEntity def itemMenuItem__on_click(): Item.launch() def personMenuItem__on_click(): Person.launch() def orderMenuItem__on_click(): Order.launch() def legalEntityMenuItem__on_click(): LegalEntity.launch() itemMenuItem = pylax.MenuItem("_Item", itemMenuItem__on_click) pylax.append_menu_item(itemMenuItem) personMenuItem = pylax.MenuItem("_Person", personMenuItem__on_click) pylax.append_menu_item(personMenuItem) pylax.append_menu_item(pylax.MenuItem("_Order", orderMenuItem__on_click)) pylax.append_menu_item( pylax.MenuItem("_Legal Entity", legalEntityMenuItem__on_click)) legalEntityMenuItem__on_click() #orderMenuItem__on_click()