def main(): win = GraphWin('Animation', 640, 480, autoflush=False) win.setCoords(-10, -10, 210, 155) Line(Point(-10, 0), Point(210, 0)).draw(win) for x in range(0, 210, 50): Text(Point(x, -5), str(x)).draw(win) Line(Point(x, 0), Point(x, 2)).draw(win) while True: inputWin = InputDialog(45, 40, 2) choice = inputWin.interact() inputWin.close() if choice == 'Quit': break angle, vel, height = inputWin.getValues() shot = ShotTracker(win, angle, vel, height) while 0 <= shot.getY() and shot.getX() > -10 and shot.getX() <= 210: shot.update(1/50) update(50) # 显示最大高度 maxHeight = "最大高度: %.2f 米" % shot.proj.maxY maxHeightWin = GraphWin('Max Height', 240, 180) Text(Point(120, 90), maxHeight).draw(maxHeightWin)
def on_add_button_clicked(self): row = self.list_container.currentRow() dialog = InputDialog() if dialog.exec(): employee = Employee(dialog.get_inputs()[1], dialog.get_inputs()[0]) if not employee.if_exist(): self.list_container.insertItem(row, str(employee)) employee.save_employee() else: dialog.print_label("employee exist")
def _edit_input(self, nodename=''): dlg = InputDialog('edit', self._dotgraphs[self._current_pipeline_name], self.dotcode_factory, dotparser, self.param_manager, nodename=nodename, parent=self._widget) dlg.exec_() self._refresh_rosgraph()
def _add_input(self): dlg = InputDialog('add', self._dotgraphs[self._current_pipeline_name], self.dotcode_factory, dotparser, self.param_manager, parent=self._widget) dlg.exec_() self._refresh_rosgraph()
async def coroutine(): open_dialog = InputDialog( title="Recipient", label_text="Enter username to share a file with:", ) username = await self.__show_dialog_as_float(open_dialog) if username is not None: encoded_message = self.msg_service.prepare_send_request( {"type": "file_share_request", "share_user": username}) self.msg_service.put_message(encoded_message)
def test_input_dialog(): title = 'test title' inp_dialog = InputDialog(title, 'test text') assert inp_dialog.__pt_container__().title == title
def input(self): self.dialog = InputDialog() self.dialog.show()