当前位置: 首页>>代码示例>>Python>>正文


Python QInputDialog.getDouble方法代码示例

本文整理汇总了Python中PyQt4.Qt.QInputDialog.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Python QInputDialog.getDouble方法的具体用法?Python QInputDialog.getDouble怎么用?Python QInputDialog.getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.Qt.QInputDialog的用法示例。


在下文中一共展示了QInputDialog.getDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ask_user

# 需要导入模块: from PyQt4.Qt import QInputDialog [as 别名]
# 或者: from PyQt4.Qt.QInputDialog import getDouble [as 别名]
 def ask_user(self):
     # Ask the user for a factor by which to multiply all font sizes
     factor, ok = QInputDialog.getDouble(
         self.gui, 'Enter a magnification factor', 'Allow font sizes in the book will be multiplied by the specified factor',
         value=2, min=0.1, max=4
     )
     if ok:
         # Ensure any in progress editing the user is doing is present in the container
         self.boss.commit_all_editors_to_container()
         try:
             self.magnify_fonts(factor)
         except Exception:
             # Something bad happened report the error to the user
             import traceback
             error_dialog(self.gui, _('Failed to magnify fonts'), _(
                 'Failed to magnify fonts, click "Show details" for more info'),
                 det_msg=traceback.format_exc(), show=True)
             # Revert to the saved restore point
             self.boss.revert_requested(self.boss.global_undo.previous_container)
         else:
             # Show the user what changes we have made, allowing her to
             # revert them if necessary
             self.boss.show_current_diff()
             # Update the editor UI to take into account all the changes we
             # have made
             self.boss.apply_container_update_to_gui()
开发者ID:forgottenleaf,项目名称:calibre,代码行数:28,代码来源:main.py


注:本文中的PyQt4.Qt.QInputDialog.getDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。