TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #380 · 21 окт.

Регулярно приходится писать и ревьюить код, где используется PySide2-6. Заметил, что в подавляющем большинстве случаев настройка создаваемых базовых виджетов происходит через методы. Думаю, всем знаком такой способ. Простой пример с кнопкой: button = QPushButton("Click Me") button.setMinimumWidth(300) button.setFlat(True) button.setStyleSheet("font-size: 20pt") button.setToolTip("Super Button") button.clicked.connect(lambda: print("Button clicked")) Но есть и альтернативный способ - настройка через свойства. Это просто ключевые аргументы конструктора класса. Хоть они и не указаны в документации как аргументы, но они есть) Этот код делает тоже самое но с помощью Property button = QPushButton( "Click Me", minimumWidth=300, flat=True, styleSheet="font-size: 20pt", toolTip="Super Button", clicked=lambda: print("Button clicked"), ) Где это может быть полезно ▫️ Это выглядит более аккуратно и коротко, уже повод использовать ▫️ Может использоваться в заполнении лейаута, когда нам не нужно никакое другое взаимодействие с виджетом и поэтому сохранять его в переменную не требуется. Например, лейбл или кнопка. widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) layout.addWidget(QLabel("Button >", alignment=Qt.AlignRight)) layout.addWidget(QPushButton("Click Me", clicked=lambda: print("Button clicked"))) widget.show() Либо так widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) for wd in ( QLabel("Button >", alignment=Qt.AlignRight), QPushButton("Click Me", clicked=lambda: ...) ): layout.addWidget(wd) widget.show() ▫️ Можно хранить настройки в каком-то конфиге или генерировать на лету, после чего передавать как kwargs. kwargs = {"text": "Hello " * 30, "wordWrap": True} my_label = QLabel(**kwargs) Как получить полный список доступных свойств? Эта функция распечатает в терминал все свойства виджета и их текущие значения def print_widget_properties(widget): meta_object = widget.metaObject() for i in range(meta_object.propertyCount()): property_ = meta_object.property(i) property_name = property_.name() property_value = property_.read(widget) print(f"{property_name}: {property_value}") #tricks#qt

Hashtags

Резултати

Пронајдени 8 слични објави

Пребарај: #matplotlib

当前筛选 #matplotlib清除筛选
djangoproject

@djangoproject · Post #423 · 26.08.2017 г., 08:39

http://scitools.org.uk/iris/docs/latest/userguide/index.html Iris seeks to provide a powerful, easy to use, and community-driven Python library for analysing and visualising #meteorological and #oceanographic data sets. With Iris you can: Use a single #API to work on your data, irrespective of its original format. Read and write (CF-)netCDF, GRIB, and PP files. Easily produce graphs and maps via integration with #matplotlib and #cartopy.

djangoproject

@djangoproject · Post #424 · 26.08.2017 г., 08:43

http://scitools.org.uk/cartopy/docs/latest/index.html Cartopy is a Python package designed to make drawing maps for data analysis and visualisation as easy as possible. #Cartopy makes use of the powerful #PROJ.4, #numpy and #shapely libraries and has a simple and intuitive drawing interface to #matplotlib for creating publication quality maps. Some of the key features of cartopy are: object oriented projection definitions point, line, vector, polygon and image transformations between projections integration to expose advanced mapping in matplotlib with a simple and intuitive interface powerful vector data handling by integrating shapefile reading with Shapely capabilities

djangoproject

@djangoproject · Post #130 · 31.08.2016 г., 15:39

http://matplotlib.org/ #matplotlib is a python #2D#plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in #python scripts, the python and #ipython shell (ala MATLAB®* or Mathematica®†), web application servers, and six #graphical user interface toolkits. screenshots

djangoproject

@djangoproject · Post #507 · 26.11.2017 г., 22:08

http://devarea.com/machine-learning-with-python-introduction/#.Whs6iCehU8o #Machine_Learning With Python – Introduction #Numpy is package for multi dimension arrays – very effective implementation #Scipy – package for scientific programming , mathematics , signal processing and more #Pandas – package for data handling #Matplotlib – package for data visualization (graphs) #Seaborn – extend Matplotlib with statistical graphs #Scikits – many extensions to spicy for specific fields like x-ray, image processing , deep learning and many more

djangoproject

@djangoproject · Post #352 · 25.06.2017 г., 08:57

https://stxnext.com/blog/2017/04/12/most-popular-python-scientific-libraries/ The most popular Python scientific libraries: #Astropy #Biopython #Cubes #DEAP #SCOOP #PsychoPy #Pandas #Mlpy #matplotlib #NumPy #NetworkX #TomoPy #Theano #SymPy #SciPy #scikit_learn #scikit_image #ScientificPython #SageMath #Veusz #graph_tool #SunPy #Bokeh

djangoproject

@djangoproject · Post #513 · 30.11.2017 г., 22:00

#AI#Artificial_Intelligence #AJAX #aiohttp #Anaconda #AngularJS #API #Atom #AWS #asyncio (#Asynchronous) #audio #automated_testing #automation #atexit #BeeWare #Big_Data #bitcoin #blockchain #Bluemix #Brython #button #Celery #client #class #classmethod #concurrency #Coroutine #cron #CSS #curl #data_analysis #data_mining #data_processing #database #Deep_Learning#deep_learning #Debian #decorator #deploy #dict #dispatch #django #django_cms #Django_REST_Framework #dropdownbox #Docker #event #Firefox #Flask #form #functions #Generator #GeoDjango #git #Google #GPU #GUI #Gym #host #HTML #httplib #learn #Image_processing #intelligence #input #Instagram #IOT #iPython #Jupyter #lambda #learn #License #Linux #lists #machine_learning #Magenta #map #Matplotlib #Metaprogramming #Micro_services #Micropython #mind #monitoring #MongoDB #modules #Mozilla #Multipart #multi_touch_apps #multiprocessing #Nodes #NoSQL #numeric_computation #numerical #NumPy #network #neural_network #OAuth #object_serialization #OCR #overloading #package #parallel #pipeline #protocols #PostGIS #pyAudioAnalysis #pycon #Pyflakes #PyInstaller #PyPI #PyQt #PySide #PyTorch #pytest #python #Pyvideo_archives #Qt #Raspberry_Pi #React #Redis #random #request #Regular_Expressions (#re) #REST #RSS #satellite #scikit_learn #SciPy #scrapy #searching #selectbox #Selenium #serialization #server #sessions #single_responsibility_principle #socket #Spark #str #submit #task #telegram #template #TensorFlow #test #text_boxes #text #tuples #unicode #Universe #Unix #unit_test #urllib #upload #uWSGI #Web #WSGI