pyqt 配置文件例子学习
# -*- coding: utf-8 -*-
# python:2.x
__author__ = 'Administrator'
import sys,datetime
from PyQt4.QtCore import Qt
from PyQt4 import QtGui,QtCore,Qt
from aa import Ui_Form
class Example(QtGui.QDialog,Ui_Form):
def __init__(self,parnet=None):
super(Example, self).__init__(parnet)
self.setupUi(self)
self.read1()
def read1(self):#读取
settings1=QtCore.QSettings(r'a.ini',QtCore.QSettings.IniFormat)#当前目录的INI文件
settings1.beginGroup('a')
settings1.setIniCodec('UTF-8')
s1=settings1.value(r'cpu:',self.lineEdit.text()).toString()
s2=settings1.value(r'cpu1:',self.lineEdit_2.text()).toString()
self.lineEdit.setText(unicode(s1))
self.lineEdit_2.setText(unicode(s2))
settings1.endGroup()
return True
def write(self):#写入
settings1=QtCore.QSettings(r'a.ini',QtCore.QSettings.IniFormat)#当前目录的INI文件
settings1.beginGroup('a')
settings1.setIniCodec('UTF-8')
s1=settings1.setValue(r'cpu:',self.lineEdit.text())
s2=settings1.setValue(r'cpu1:',self.lineEdit_2.text())
self.lineEdit.setText(unicode(s1))
self.lineEdit_2.setText(unicode(s2))
settings1.endGroup()
return True
def closeEvent(self, event):
reply = QtGui.QMessageBox.question(self, 'Message',
"Are you sure to quit?", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
self.write()
event.accept()
else:
event.ignore()
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())
main()
如图:

pyqt 配置文件例子学习的更多相关文章
- pyqt QTreeWidget例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt columnView例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt QTableView例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt QTableWidget例子学习(重点)
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...
- pyqt 托盘例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...
- pyqt 正则表达式例子学习
def rex01(self): username=QtCore.QRegExp('[a-zA-Z0-9_]{2,10}') self.names.setValidator(QtGui.QRegExp ...
- pyqt tabWidget例子学习1
from PyQt4 import QtGui from PyQt4 import QtCore from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT impor ...
- pyqt 自定义例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' import sys from PyQt4.QtCore impor ...
- 数百个 HTML5 例子学习 HT 图形组件 – 3D建模篇
http://www.hightopo.com/demo/pipeline/index.html <数百个 HTML5 例子学习 HT 图形组件 – WebGL 3D 篇>里提到 HT 很 ...
随机推荐
- java 版本SQLHelper
package com.jack.SQLHelper; import java.sql.*;import java.util.logging.*;import javax.swing.table.*; ...
- Oracle—RMAN备份(三)
一.增量备份的相关概念 1. 在前面说明了RMAN的完整备份,完整备份是备份所用使用过的块,不备份没有使用的过的块:增量备份只备份自上次备份以来更改过的块. 2.即使RMAN的默认操作是在增量备份时扫 ...
- 【ArcGIS 10.2新特性】ArcGIS Online新特性(上)
概述 7月,ArcGIS Online发布了很多更新.主要内容有:新的网站设计,增强了Web制图,数据分析,应用程序创建,以及机构管理等功能. 更新的大致内容总结如下: 地图查看器:新的分析工具.获取 ...
- qwtplot3D安装及运行-----终结解决方案
..\qwtplot3d\include\qwt3d_openglhelper.h:67: 错误:'gluErrorString' was not declared in this scope..\q ...
- Ubuntu 10.04下安装Opengl glx
1.安装OpenGL Library sudo apt-get install build-essential 2. 安装OpenGL Utilities sudo apt-get install l ...
- 监控工具cacti
一. 安装 cacti服务端 1. 首先要安装epel扩展源yum install -y epel-release2. (lamp)然后分别安装httpd.php.mysqlyum install - ...
- 使用RDS不得不知的注意事项
使用RDS不得不知的注意事项 1.RDS实例升级需要注意的事项 RDS在进行实例升级的过程中会出现最长30秒左右的连接闪断,需要您提前做好准备,并设置好程序跟RDS的自动重连,避免因为升级的闪断导致您 ...
- IEquatable(T) interface in .Net
原文:http://weblogs.asp.net/pawanmishra/iequatable-t-interface-in-net 泛型方法: public static bool AreEqua ...
- Code First 数据注释--InverseProperty 和 ForeignKey
ForeignKey 按照约定在Post类中看到BlogId属性,会认为是Blog类的外键,但是在Blog类中并没有BlogId属性,解决方法是,在 Post 中创建一个导航属性,并使用 Foreig ...
- ORACLE函数详解【weber出品】
一.什么是函数 一个函数: 1. 是命名的PL/SQL块,必须返回一个值 2. 可以存储到数据库中重复执行 3. 可以作为表达式的一部分或者提供一个参数值 二.创建函数的语法 必须至少有一个返回值,创 ...