python3+PyQt5实现自定义罗马数字的微调框。
#!/usr/bin/env python3
import re
import sys
from PyQt5.QtCore import QRegExp, Qt
from PyQt5.QtWidgets import (QApplication, QSpinBox)
from PyQt5.QtGui import QRegExpValidator
def romanFromInt(integer):
"""
Code taken from Raymond Hettinger's code in Victor Yang's "Decimal
to Roman Numerals" recipe in the Python Cookbook.
>>> r = [romanFromInt(x) for x in range(1, 4000)]
>>> i = [intFromRoman(x) for x in r]
>>> i == [x for x in range(1, 4000)]
True
"""
coding = zip(
[1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
["M", "CM", "D",