Skip to content

Instantly share code, notes, and snippets.

@teionn
Created August 16, 2019 05:35
Show Gist options
  • Save teionn/5cb7b2a543e83bfd49c3d76321b7421c to your computer and use it in GitHub Desktop.
Save teionn/5cb7b2a543e83bfd49c3d76321b7421c to your computer and use it in GitHub Desktop.
readfile on maya (pyside2)
from PySide2.QtGui import QDesktopServices
from PySide2.QtCore import QUrl
QDesktopServices.openUrl(QUrl.fromLocalFile(r"C:\WINDOWS\win.ini"))
from PySide2.QtCore import QFile
from PySide2.QtWidgets import QTextEdit
textEdit = QTextEdit()
textEdit.setReadOnly(True)
text_file = QFile("{}/userPrefs.mel".format(cmds.internalVar(userPrefDir=True)))
text_file.open(QFile.ReadOnly | QFile.Text)
textEdit.setPlainText(text_file.readAll().data().decode("shift-jis"))
textEdit.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment