How to do vector diagram in python script?

How to do vector diagram in python script?

2368457978
Enthusiast Enthusiast
411 Views
2 Replies
Message 1 of 3

How to do vector diagram in python script?

2368457978
Enthusiast
Enthusiast

Hi, do you know how this clickable vector diagram is made? Is it ps or Python?
947f7a701ad74fa2fed2ccb2d7121a3.png

0 Likes
Accepted solutions (1)
412 Views
2 Replies
Replies (2)
Message 2 of 3

jmreinhart
Advisor
Advisor
Accepted solution
cmds.window()
cmds.columnLayout()
cmds.iconTextButton(image1 = 'bowlCurveProfile.png')
cmds.showWindow()

Also here is the script  I used to find the name of the icon maya uses.

try:
  from PySide2.QtCore import *
  from PySide2.QtGui import *
  from PySide2.QtWidgets import *
  from PySide2 import __version__
  from shiboken2 import wrapInstance
except ImportError:
  from PySide.QtCore import *
  from PySide.QtGui import *
  from PySide import __version__
  from shiboken import wrapInstance

import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMayaUI as omui

class basic_ui(QWidget):# Create a class that inherits from the QWidget class
    def __init__(self, *args, **kwargs):#initialize function
        super(basic_ui, self).__init__(*args, **kwargs)
        
        # Create the needed variables

        # Get the main window as a widget
        omui.MQtUtil.mainWindow()
        ptr = omui.MQtUtil.mainWindow()
        mainWindow_widget = wrapInstance(long(ptr), QWidget)
        self.mainWindow_widget = mainWindow_widget
        #Parent widget under Maya main window
        self.setParent(mainWindow_widget)
        self.setWindowFlags(Qt.Window)
        self.setObjectName('iconPrinter')
        #Delete the UI if an instance already exists
        try:
            child_windows = mainWindow_widget.findChildren(QWidget)
            for widget in child_windows:
                if widget is not self:
        	        if widget.objectName() == self.objectName():
    					widget.close()
    	except:
    	    pass

        #Set the object name, window title, and window size
        self.setWindowTitle('Icon Printer')
        self.setGeometry(50, 50, 250, 150)
        self.initUI()

    def changeEvent(self,event):
        pass

    def closeEvent(self,event):
        pass

    def initUI(self):
        # Create the main layout
        self.window_layout = QVBoxLayout()
        self.setLayout(self.window_layout)
        self.iconList = QListWidget()
        self.window_layout.addWidget(self.iconList)
        self.populateIconList()
    
    def populateIconList(self):
        for icon in cmds.resourceManager(nameFilter='*') or []:
            newItem = QListWidgetItem(icon)
            self.iconList.addItem(newItem)
            newItem.setIcon(QIcon(":/" + icon))

basic_ui().show()
0 Likes
Message 3 of 3

2368457978
Enthusiast
Enthusiast
Thank you. I found that this script can't copy the icon name. It would be better if it could be copied.
0 Likes