python - PyQt: How can I change the texts of my QInputDialog buttons? -
i want change text buttons (ok, cancel) in qinputdialog box, how can achieve this? want use python's gettext translations, not qt linqvist.
# set maximum file size def maximumfilesize(self): # user input maxsize, ok = qtgui.qinputdialog.getint(self, "maximum file size", "enter maximum file size in bytes:", self.maxsize, 1, 1073741824) # if ok clicked... if ok: if maxsize <= 0: message = "maximum file size cannot less 1." qtgui.qmessagebox.critical(self, "error", message) return false # set new maximum file size self.maxsize = maxsize
the qinputdialog contains methods setokbuttontext , setcancelbuttontext, however, static method gitint using creates qinputdialog object, visible inside getint method , not accessible you.
i suggest create own inputintegerdialog(qtgui.qinputdialog), on you'll have manually add spinbox , set properties. able change text on both buttons, because dialog object under control, not created somewhere inside pyqt.
btw, if wish translate standard buttons, may want see this question.
Comments
Post a Comment