import sys
from PyQt5 import QtWidgets
from QHexEdit import QHexEdit, QHexEditData


class HexEdit(QHexEdit):

    def __init__(self, fileName=None):
        super(HexEdit, self).__init__()
        file = open(fileName)
        data = file.read()
        self.setData(data)
        self.setReadOnly(False)


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)

    # QHexEditData* hexeditdata = QHexEditData::fromFile("data.bin");
    data = QHexEditData.fromFile('test.py')

    # QHexEdit* hexedit = new QHexEdit();
    # hexedit->setData(hexeditdata);
    mainWin = QHexEdit()
    mainWin.setData(data)

    mainWin.show()
    sys.exit(app.exec_())

import sys
from PyQt5 import QtWidgets, QtGui
from QHexEdit import QHexEdit, QHexEditData

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)

    # QHexEditData* hexeditdata = QHexEditData::fromFile("test.py");
    hexeditdata = QHexEditData.fromFile('test.py')

    # QHexEdit* hexedit = new QHexEdit();
    # hexedit->setData(hexeditdata);
    hexedit = QHexEdit()
    hexedit.setData(hexeditdata)

    hexedit.show()

    # hexedit->commentRange(0, 12, "I'm a comment!");
    hexedit.commentRange(0, 12, "I'm a comment!")

    # hexedit->highlightBackground(0, 10, QColor(Qt::Red));
    hexedit.highlightBackground(0, 10, QtGui.QColor(255, 0, 0))

    sys.exit(app.exec_())

Test more stuff in python
Test more stuff in python

  import sys
- from PyQt5 import QtWidgets
+ from PyQt5 import QtWidgets, QtGui
  from QHexEdit import QHexEdit, QHexEditData
- 
- 
- class HexEdit(QHexEdit):
- 
-     def __init__(self, fileName=None):
-         super(HexEdit, self).__init__()
-         file = open(fileName)
-         data = file.read()
-         self.setData(data)
-         self.setReadOnly(False)
- 
  
  if __name__ == '__main__':
      app = QtWidgets.QApplication(sys.argv)
  
-     # QHexEditData* hexeditdata = QHexEditData::fromFile("data.bin");
+     # QHexEditData* hexeditdata = QHexEditData::fromFile("test.py");
-     data = QHexEditData.fromFile('test.py')
+     hexeditdata = QHexEditData.fromFile('test.py')
  
      # QHexEdit* hexedit = new QHexEdit();
      # hexedit->setData(hexeditdata);
-     mainWin = QHexEdit()
+     hexedit = QHexEdit()
-     mainWin.setData(data)
+     hexedit.setData(hexeditdata)
  
-     mainWin.show()
+     hexedit.show()
+ 
+     # hexedit->commentRange(0, 12, "I'm a comment!");
+     hexedit.commentRange(0, 12, "I'm a comment!")
+ 
+     # hexedit->highlightBackground(0, 10, QColor(Qt::Red));
+     hexedit.highlightBackground(0, 10, QtGui.QColor(255, 0, 0))
+ 
      sys.exit(app.exec_())
  
Test more stuff in python
## Code Before:
import sys
from PyQt5 import QtWidgets
from QHexEdit import QHexEdit, QHexEditData


class HexEdit(QHexEdit):

    def __init__(self, fileName=None):
        super(HexEdit, self).__init__()
        file = open(fileName)
        data = file.read()
        self.setData(data)
        self.setReadOnly(False)


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)

    # QHexEditData* hexeditdata = QHexEditData::fromFile("data.bin");
    data = QHexEditData.fromFile('test.py')

    # QHexEdit* hexedit = new QHexEdit();
    # hexedit->setData(hexeditdata);
    mainWin = QHexEdit()
    mainWin.setData(data)

    mainWin.show()
    sys.exit(app.exec_())

## Instruction:
Test more stuff in python
## Code After:
import sys
from PyQt5 import QtWidgets, QtGui
from QHexEdit import QHexEdit, QHexEditData

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)

    # QHexEditData* hexeditdata = QHexEditData::fromFile("test.py");
    hexeditdata = QHexEditData.fromFile('test.py')

    # QHexEdit* hexedit = new QHexEdit();
    # hexedit->setData(hexeditdata);
    hexedit = QHexEdit()
    hexedit.setData(hexeditdata)

    hexedit.show()

    # hexedit->commentRange(0, 12, "I'm a comment!");
    hexedit.commentRange(0, 12, "I'm a comment!")

    # hexedit->highlightBackground(0, 10, QColor(Qt::Red));
    hexedit.highlightBackground(0, 10, QtGui.QColor(255, 0, 0))

    sys.exit(app.exec_())
