ZetCode PyQt4 tutorial widgets II】的更多相关文章

#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we dispay an image on the window. author: Jan Bodnar website: zetcode.com last edited: September 2011 """ import sys from PyQt4 import QtGu…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, a QtGui.QCheckBox widget is used to toggle the title of a window. author: Jan Bodnar website: zetcode.com last edited: September 2011 """ i…
!/usr/bin/python -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial This example shows three labels on a window using absolute positioning. author: Jan Bodnar website: zetcode.com last edited: October 2011 """ import sys from P…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we create a simple window in PyQt4. author: Jan Bodnar website: zetcode.com last edited: October 2011 """ # Here we provide the necessary i…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial This is a simple drag and drop example. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from PyQt4 import QtGui # In order…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we receive data from a QtGui.QInputDialog dialog. author: Jan Bodnar website: zetcode.com last edited: October 2011 """ import sys from PyQ…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we connect a signal of a QtGui.QSlider to a slot of a QtGui.QLCDNumber. author: Jan Bodnar website: zetcode.com last edited: October 2011 ""&quo…
!/usr/bin/python -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial This program creates a statusbar. author: Jan Bodnar website: zetcode.com last edited: September 2011 """ import sys from PyQt4 import QtGui class Example(QtGu…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we create a custom widget. author: Jan Bodnar website: zetcode.com last edited: October 2011 """ import sys from PyQt4 import QtGui, QtCore…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we draw text in Russian azbuka. author: Jan Bodnar website: zetcode.com last edited: September 2011 """ import sys from PyQt4 import QtGui,…
PyQt4里的对话框 对话框是大多数GUI应用中不可分割的一部分.一个对话框是两者或多者的会话.在GUI内,对话框是应用向人说话的方式.一个对话框可以用来输入数据,修改数据,改变应用设置等等. QtGui.QInputDialog QtGui.QInputDialog给用户提供了一个简单方便的对话框来获取值.输入的值可以使字符串,一个数字,或者是一个列表中的元素. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode Py…
在PyQt4中的事件和信号 事件 所有的GUI应用都是事件驱动的.事件主要是来自于应用的使用者,但是像互联网连接,窗口管理器或者计时器也可以产生事件.当我们调用应用的exec_()方法时,应用就进入了主循环.主循环将抓取事件并且将其发送到对应的对象中去. 在事件模型中,有三个参与者: 事件源 事件对象 事件目标 事件源是改变状态的对象.它生成事件.事件对象囊括了在事件源中状态的改变情况.事件目标是将要通知的对象,事件源通过事件来操控事件对象. PyQ4有独一无二的信号和槽机制去处理事件.信号和槽…
# PyQt4入门学习笔记(三) PyQt4内的布局 布局方式是我们控制我们的GUI页面内各个控件的排放位置的.我们可以通过两种基本方式来控制: 1.绝对位置 2.layout类 绝对位置 这种方式要求程序员必须得指定好每个控件的位置和尺寸.当我们使用绝对位置时,我们得明白下面的几条限制: 当我们改变窗口大小时,控件的尺寸和位置不会改变. 我们的应用可能看起来和一般的应用有所不同. 改变前端页面可能会让我们的应用崩溃 如果我们决定要改变我们的布局时,我们必须要把所有控件的位置全部更新 下面这个例…
之前第一篇介绍了pyqt4的大小,移动位置,消息提示.这次我们介绍菜单和工具栏 QtGui.QmainWindow这个类可以给我们提供一个创建带有状态栏.工具栏和菜单栏的标准的应用. 状态栏 状态栏是展示状态信息的部件. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial This program creates a statusbar. author: Jan Bodnar website…
PyQt4入门学习笔记(一) 一直没有找到什么好的pyqt4的教程,偶然在google上搜到一篇不错的入门文档,翻译过来,留以后再复习. 原始链接如下: http://zetcode.com/gui/pyqt4/firstprograms/ 在这篇PyQt4的入门文档,我们讲学习一些基础功能. 简单的例子 这是一个显示一个小窗口的简单例子.我们可以对这个窗口做一些操作.我们可以改变它的大小,最大化它,或者最小化它.这需要大量的编码.有人已经写好了这些基础函数,因为它在绝大部分应用中重复出现,不需…
Reference:http://zetcode.com/gui/pyqt4/eventsandsignals/ Events and Signals in PyQt4 In this part of the PyQt4 programming tutorial, we will explore events and signals occurring in applications.   Events All GUI applications are event-driven. Events…
QCalendarWidget QCalendarWidget 提供基于月份的日历窗口组件,它允许用户简单并且直观的选择日期. #!/usr/bin/python # -*- coding: utf-8 -*- # calendar.py import sys from PyQt4 import QtGui from PyQt4 import QtCore class Example(QtGui.QWidget): def __init__(self): super(Example, self)…
你是否曾经看着应用程序并思考特定的GUI项是如何产生的?大概每位程序员都这样过.然后你能看到你喜欢的GUI库提供的一系列窗口组件,但是你无法找到它.工具包通常仅仅提供最常用的窗口组件,比如按钮.文本组件.滑块等等.没有工具包能够提供一切可能的组件. 实际上有两种工具包,轻量级和重量级.FLTK工具包是一种轻量级的工具包,它仅仅提供非常基本的组件并假设程序员能够自己创建更复杂的组件.PyQt4属于重量级,它有很多窗口组件,但是并不提供非常专业化的窗口组件.比如速度计窗口组件,用来度量烧录的CD的容…
在PyQt4教程的这部分中,我们讨论拖放操作. 拖放(Drag-and-drop)指的是图形用户界面(Graphical user interface)中,在一个虚拟的对象上按着鼠标键将之拖曳到另一个地方或另一虚拟对象之上的动作(或是支持着这样的界面的技术).一般而言,这可以用来产生很多动作,或是在两个抽象对象当中产生各式各样的连接. 拖放操作功能是图形用户界面最明显的方面之一.拖放操作能使用户直观的做复杂的事情. 通常,我们可以拖放两类东西:数据或者一些图形对象.如果我们从一个程序拖动图片到另…
QLineEdit QLineEdit 窗口组件用来输入或者编辑单行纯文本,有撤销/重做,剪切/粘贴和拖放功能. #!/usr/bin/python # -*- coding: utf-8 -*- # ZetCode PyQt4 tutorial # # This example shows text which # is entered in a QLineEdit # in a QLabel widget. # # author: Jan Bodnar # website: zetcode.…
sklearn实战-乳腺癌细胞数据挖掘(博客主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&utm_campaign=commission&utm_source=cp-400000000398149&utm_medium=share http://zetcode.com/gui/pyqt4/layoutmanagement/ zetcode官网 PyQt4 tutorial T…
We can provide a balloon help for any of our widgets. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial This example shows a tooltip on a window and a button author: Jan Bodnar website: zetcode.com last edited: October 20…
This is a simple example showing a small window. Yet we can do a lot with this window. We can resize it, maximise it, or minimise it. This requires a lot of coding. Someone already coded this functionality. Because it repeats in most applications, th…
Widgets can span multiple columns or rows in a grid. In the next example we illustrate this. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we create a bit more complicated window layout using the QtGu…
Layout management with layout classes is much more flexible and practical. It is the preferred way to place widgets on a window. The QtGui.QHBoxLayout and QtGui.QVBoxLayout are basic layout classes that line up widgets horizontally and vertically. Im…
The programmer specifies the position and the size of each widget in pixels. When you use absolute positioning, we have to understand the following limitations: The size and the position of a widget do not change if we resize a window Applications mi…
A QtGui.QSplitter lets the user control the size of child widgets by dragging the boundary between the children. In our example, we show three QtGui.QFrame widgets organized with two splitters. #!/usr/bin/python # -*- coding: utf-8 -*- """…
A QtGui.QPixmap is one of the widgets used to work with images. It is optimized for showing images on screen. In our code example, we will use the QtGui.QPixmap to display an image on the window. #!/usr/bin/python # -*- coding: utf-8 -*- """…
1 安装python 安装python-2.7.6.msi默认在c盘 设置环境变量,path后追加c:/python27.可以在命令行直接认识命令python 2 安装pyqt PyQt4-4.10-gpl-Py2.7-Qt4.8.4-x32.exe,会自动寻找python路径,并装在python安装目录下 测试:命令行进入python.敲入 import PyQt4.如果没有报错说明安装pyqt成功 3 编写代码 网上下了一个例子,出处: #!/usr/bin/python # -*- cod…
A menubar is a common part of a GUI application. It is a group of commands located in various menus. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial This program creates a menubar. The menubar has one menu with an exit…