简体   繁体   中英

Python: Pyqt Receive Hex format integer only from Plaintext

I want to receive single byte data from user from a plaintext_edit but i want to make sure it is entered in hex format, 0x with prefix or else will result in unknown type

Example : 0x3f

-Thanks

You didn't say but I am guessing you are using pyqt . Define a handler for the control's keyPressEvent and filter the user input there. That won't raise a type error. Instead you ensure that only valid data gets entered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM