pyqt练习x3.7

# -*- coding: cp936 -*-

import sys

from PyQt4 import QtGui,QtCore

class GridLayout(QtGui.QWidget):

def __init__(self,parent=None):

QtGui.QWidget.__init__(self)

self.setWindowTitle(‘grid layout‘)

title=QtGui.QLabel(‘Titel:‘)

authot=QtGui.QLabel(‘Auhot:‘)

review=QtGui.QLabel(‘Review:‘)

titleEdit=QtGui.QLineEdit()

authotEdit=QtGui.QLineEdit()

reviewEdit=QtGui.QLineEdit()

grid=QtGui.QGridLayout()

grid.setSpacing(0.1)

grid.addWidget(title,1,0)

grid.addWidget(titleEdit,1,1)

grid.addWidget(authot,2,0)

grid.addWidget(authotEdit,2,1)

grid.addWidget(review,3,0)

grid.addWidget(reviewEdit,3,1)

self.setLayout(grid)

self.resize(350,300)

app=QtGui.QApplication(sys.argv)

qb=GridLayout()

qb.show()

sys.exit(app.exec_())

如图:

时间: 2024-10-07 05:39:33

pyqt练习x3.7的相关文章

pyqt练习x3

# -*- coding: utf-8 -*- __author__ = 'Administrator' from PyQt4 import QtCore,Qt,QtGui import sys,time,datetime,os,sched,psutil,wmi from tools import Ui_Form class ExTools(QtGui.QDialog): def __init__(self,parent=None): super(ExTools,self).__init__(p

pyqt练习x3.12

import sys from PyQt4.QtGui import * class Browser(QWidget): def __init__(self): super(Browser, self).__init__() self.resize(700, 600) self.setWindowTitle("File Browser") self.treeView = QTreeView() self.fileSystemModel = QFileSystemModel(self.t

pyqt练习x3.20

#_*_ coding: utf-8 _*_ from PyQt4.QtCore import * from PyQt4.QtGui import * import sys QTextCodec.setCodecForTr(QTextCodec.codecForName("utf8")) class FindDialog(QDialog): def __init__(self,parent = None): super(FindDialog, self).__init__(parent

pyqt练习x3.14

import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * class MyBrowser(QWidget): def __init__(self, parent = None): super(MyBrowser, self).__init__(parent) self.createLayout() self.createConnection() def search(s

pyqt练习x3.13

import time import ctypes import ctypes.wintypes SEE_MASK_NOCLOSEPROCESS = 0x00000040 SEE_MASK_INVOKEIDLIST = 0x0000000C class SHELLEXECUTEINFO(ctypes.Structure): _fields_ = ( ("cbSize",ctypes.wintypes.DWORD), ("fMask",ctypes.c_ulong),

pyqt练习x3.21

#!/usr/bin/env python2 "A web browser that will never exceed 128 lines of code. (not counting blanks)" import sys, os, json, tempfile from PyQt4 import QtGui, QtCore, QtWebKit, QtNetwork settings = QtCore.QSettings("ralsina", "dev

pyqt练习x3。1

# -*- coding: cp936 -*- import sys from PyQt4 import QtGui class MessageBox(QtGui.QWidget): def __init__(self,parent=None): QtGui.QWidget.__init__(self,parent) self.setGeometry(300,300,250,150) self.setWindowTitle(u'你想关闭?') def closeEvent(self,event)

pyqt练习x3.3

# -*- coding: cp936 -*- import sys from PyQt4 import QtGui class Tooltip(QtGui.QWidget): def __init__(self,parent=None): QtGui.QWidget.__init__(self,parent) self.setGeometry(300,300,250,150) self.setWindowTitle(u'屏幕提示内容') self.setToolTip(u'这是什么呢?') Q

pyqt练习x3.11

#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################################## #                                                                                      # # Copyright (c) 2009 Jakob