首页 > 代码库 > pyqt练习之显示坐标信息

pyqt练习之显示坐标信息

def mouseMoveEvent(self,e):

        px=e.x()

        py=e.y()

        locats=QtCore.QString(‘x:%1, y:%2‘).arg(px).arg(py)

        self._tools.las.setText(unicode(locats))

如图:

 

self.visi.sizeTab.colorbuck.setFocus()#获取焦点
self._tools.pbs_5.setShortcut(‘Alt+S‘)#设置快捷键
self.setMouseTracking(1)#追踪信息

self.fk01.t_sina.setText(u‘<a href=http://weibo.com/fangjiayu1107>新浪微博</a>‘)

如图:

self.sizeTab.colorbuck.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)#不能对表格内容进行修改
self.sizeTab.colorbuck.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)#选中单个单元格
#self.sizeTab.colorbuck.setSelectionBehavior(QtGui.QAbstractItemView.SingleSelection )#选中单个目标

self.setWindowFlags(QtCore.Qt.FramelessWindowHint)#去掉标题栏

class F_k(QtGui.QDialog):

    def __init__(self):

        super(F_k,self).__init__()

        self.fk01=Ui_Form3()

        self.fk01.setupUi(self)

        self.setWindowTitle(u‘小工具集‘)

        self.setWindowIcon(QtGui.QIcon(r‘imags\xm.png‘))

        self.setFixedSize(280,140)

        self.fk01.t_sina.setText(u‘<a href=http://weibo.com/fangjiayu1107>新浪微博</a>‘)

        self.fk01.t_sina_2.setText(u‘<a href=http://www.cnblogs.com/mhxy13867806343>博客园</a>‘)#

        self.fk01.label_4.setText(u‘<a href=http://m1.mail.sina.com.cn>更多>>></a>‘)

        self.fk01.t_sina.linkActivated.connect(self.openurl1)

        self.fk01.t_sina_2.linkActivated.connect(self.openurl1)

        self.fk01.label_4.linkActivated.connect(self.openurl1)

    def openurl1(self,url):

        QtGui.QDesktopServices.openUrl(QtCore.QUrl(url))

如图:

pyqt练习之显示坐标信息