This article mainly introduces Python PyQt4 to implement QQ drawer effect in detail. It has certain reference value. Interested friends can refer to it.
The example of this article shares with everyone the implementation of QQ in Python PyQt4. The specific code for displaying the drawer effect is for your reference. The specific content is as follows
First look at the screenshot effect:
Mainly uses QT’s QTabWidget and QToolBox Page widget
# -*- coding: utf-8 -*- from PyQt4.QtGui import * from PyQt4.QtCore import * import sys QTextCodec.setCodecForTr(QTextCodec.codecForName("utf8")) class MyQQ(QTabWidget): def __init__(self,parent=None): super(MyQQ,self).__init__(parent) toolButton1=QToolButton() toolButton1.setText(self.tr("gavin")) toolButton1.setIcon(QIcon("d:/image/1.png")) toolButton1.setIconSize(QSize(60,60)) toolButton1.setAutoRaise(True) toolButton1.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) toolButton2=QToolButton() toolButton2.setText(self.tr("问题的方法")) toolButton2.setIcon(QIcon("d:/image/2.png")) toolButton2.setIconSize(QSize(60,60)) toolButton2.setAutoRaise(True) toolButton2.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) toolButton3=QToolButton() toolButton3.setText(self.tr("为什么")) toolButton3.setIcon(QIcon("d:/image/3.png")) toolButton3.setIconSize(QSize(60,60)) toolButton3.setAutoRaise(True) toolButton3.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) groupbox1=QGroupBox() vlayout1=QVBoxLayout(groupbox1) vlayout1.setMargin(10) vlayout1.setAlignment(Qt.AlignCenter) vlayout1.addWidget(toolButton1) vlayout1.addWidget(toolButton2) vlayout1.addStretch() groupbox2=QGroupBox() vlayout2=QVBoxLayout(groupbox2) vlayout2.setMargin(10) vlayout2.setAlignment(Qt.AlignCenter) vlayout2.addWidget(toolButton3) vlayout2.addStretch() groupbox3=QGroupBox() toolbox1 = QToolBox() toolbox1.addItem(groupbox1,self.tr("我的好友")) toolbox1.addItem(groupbox2,self.tr("同事")) toolbox1.addItem(groupbox3,self.tr("黑名单")) toolbox2 = QToolBox() self.addTab(toolbox1, "联系人") self.addTab(toolbox2, "群/讨论组") app=QApplication(sys.argv) myqq=MyQQ() myqq.setWindowTitle("QQ2012") myqq.show() app.exec_()
Problem record
1. When using Chinese in the script, an error message appears:
SyntaxError:
'utf8' codec can't decode byte 0xc4 in position 0: invalid continuation byte
Need to save the *.py file as utf-8, I use gvim, and I have never understood the encoding settings of vim, so I used a relatively stupid method, opening it with Notepad and saving it as utf-8 format
2. At the beginning , I placed the avatar directory image in the \Python32\Lib\site-packages directory, and then called the module in the explanation, but it could not be displayed. Later, I changed to the absolute path
The above is the detailed content of Python PyQt4 implements QQ drawer effect. For more information, please follow other related articles on the PHP Chinese website!

ToappendelementstoaPythonlist,usetheappend()methodforsingleelements,extend()formultipleelements,andinsert()forspecificpositions.1)Useappend()foraddingoneelementattheend.2)Useextend()toaddmultipleelementsefficiently.3)Useinsert()toaddanelementataspeci

TocreateaPythonlist,usesquarebrackets[]andseparateitemswithcommas.1)Listsaredynamicandcanholdmixeddatatypes.2)Useappend(),remove(),andslicingformanipulation.3)Listcomprehensionsareefficientforcreatinglists.4)Becautiouswithlistreferences;usecopy()orsl

In the fields of finance, scientific research, medical care and AI, it is crucial to efficiently store and process numerical data. 1) In finance, using memory mapped files and NumPy libraries can significantly improve data processing speed. 2) In the field of scientific research, HDF5 files are optimized for data storage and retrieval. 3) In medical care, database optimization technologies such as indexing and partitioning improve data query performance. 4) In AI, data sharding and distributed training accelerate model training. System performance and scalability can be significantly improved by choosing the right tools and technologies and weighing trade-offs between storage and processing speeds.

Pythonarraysarecreatedusingthearraymodule,notbuilt-inlikelists.1)Importthearraymodule.2)Specifythetypecode,e.g.,'i'forintegers.3)Initializewithvalues.Arraysofferbettermemoryefficiencyforhomogeneousdatabutlessflexibilitythanlists.

In addition to the shebang line, there are many ways to specify a Python interpreter: 1. Use python commands directly from the command line; 2. Use batch files or shell scripts; 3. Use build tools such as Make or CMake; 4. Use task runners such as Invoke. Each method has its advantages and disadvantages, and it is important to choose the method that suits the needs of the project.

ForhandlinglargedatasetsinPython,useNumPyarraysforbetterperformance.1)NumPyarraysarememory-efficientandfasterfornumericaloperations.2)Avoidunnecessarytypeconversions.3)Leveragevectorizationforreducedtimecomplexity.4)Managememoryusagewithefficientdata

InPython,listsusedynamicmemoryallocationwithover-allocation,whileNumPyarraysallocatefixedmemory.1)Listsallocatemorememorythanneededinitially,resizingwhennecessary.2)NumPyarraysallocateexactmemoryforelements,offeringpredictableusagebutlessflexibility.

InPython, YouCansSpectHedatatYPeyFeLeMeReModelerErnSpAnT.1) UsenPyNeRnRump.1) UsenPyNeRp.DLOATP.PLOATM64, Formor PrecisconTrolatatypes.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version
