一、Python教程
官网:https://www.python.org/
w3cSchool
菜鸟教程
Python 入门指南
Python 入门基础
Python视频教程(bilibi-小甲鱼)
二、pycharm安装
pycharm、Idea 安装关键步骤
1、pycharm快捷键
三、PySide6、PyQt5
1、pyside2
//安装
pip install pyside2
2、PyQt5
PyQt5从入门到实践
《Python GUI设计PyQt5从入门到实践》书籍配套视频
PyQt5界面美化教程
(1)安装
pip install PyQt5
pip install pyqt5-tools
pip install PyQt5Designer
(2)pycharm设置外部程序
External Libraries->Lib->site-packages->QtDesigner->designer.exe 右键复制绝对路径
File->Settings->Tools->External Tools 点击+号
Name:Qt Designer
Program:刚才复制的designer.exe的绝对路径
Working directory:$ProjectFileDir$
点击+号
Name:PyUic
Program:工程使用的python.exe的路径
Arguments:-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py
Working directory:$FileDir$
Name:PyUic
Program:工程使用的pyuic5.exe的路径
Arguments:$FileName$ -o $FileNameWithoutExtension$.py
Working directory:$FileDir$
Name:PyRcc
Program:工程使用的pyrcc5.exe的路径
Arguments:$FileName$ -o $FileNameWithoutExtension$_rc.py
Working directory:$FileDir$
右击工程区:External Tool->Qt Designer,创建一个窗体(MainWindow、Widget)
窗体名右击:External Tool->PyUic,生成py文件
编辑生成的窗体py文件:
if __name__ == '__main__':
app=QtWidgets.QApplication(sys.argv)
widget=QtWidgets.QWidget()
ui=Ui_Form()
ui.setupUi(widget)
widget.show()
sys.exit(app.exec_())
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
import CMyMinWindow #窗体类名
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv) #([])
myMainWindow = QMainWindow()
ui = CMyMainWindow.Ui_MainWindow() #窗体类名
ui.setupUi(myMainWindow)
myMainWindow.show()
sys.exit(app.exec_())
三、语法
1、查看内置函数
dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']