def ok(button): info = Dialog("", 40, 6) bInfoOk = Button(1, "Ok") label = Label("", 38) info.addComponent(label, 1, 2) info.addComponent(bInfoOk, 31, 4) info.center() label.setText("Entered: " + "".join(cmbPath.text)) def infoOk(button): info.destroy() dialog.focus() bInfoOk.setCallback(infoOk) dialog.unfocus() info.draw() info.focus()
def ok(button): info = Dialog("", 40, 6) bInfoOk = Button(1, "Ok") label = Label("", 38) info.addComponent(label, 1, 2) info.addComponent(bInfoOk, 31, 4) info.center() value = dropdown.getValue() label.setText("Selected: " + value['label'] + " (" + value['value'] + ")") def infoOk(button): info.destroy() dialog.focus() bInfoOk.setCallback(infoOk) dialog.unfocus() info.draw() info.focus()
def ok(button): info = Dialog("", 40, 6) bInfoOk = Button(1, "Ok") label = Label("", 38) info.addComponent(label, 1, 2) info.addComponent(bInfoOk, 31, 4) info.center() selected = [] for i in xrange(0, len(checkbox)): if checkbox[i].checked: selected.append(i + 1) label.setText("Selected: " + str(selected)) def infoOk(button): info.destroy() dialog.focus() bInfoOk.setCallback(infoOk) dialog.unfocus() info.draw() info.focus()
def take_screenshot(self): try: os.mkdir(os.path.join(directories.getCacheDir(), "screenshots")) except OSError: pass screenshot_name = os.path.join(directories.getCacheDir(), "screenshots", time.strftime("%Y-%m-%d (%I-%M-%S-%p)")+".png") pygame.image.save(pygame.display.get_surface(), screenshot_name) self.diag = Dialog() lbl = Label(_("Screenshot taken and saved as '%s'")%screenshot_name, doNotTranslate=True) folderBtn = Button("Open Folder", action=self.open_screenshots_folder) btn = Button("Ok", action=self.screenshot_notify) buttonsRow = Row((btn,folderBtn)) col = Column((lbl,buttonsRow)) self.diag.add(col) self.diag.shrink_wrap() self.diag.present()