سؤال

I would like to make a button created with

myButton = QtGui.QPushButton()

active (so if the user hits Enter keyboard key THIS button is pressed). On OSX you can easily see which dialog box button is in such 'active' state because it would be colored in light blue ( and there is some form of "glowing=swimming" animation going on). What attribute needs to be set to make this button a current?

هل كانت مفيدة؟

المحلول

Try this:

myButton.setDefault(True)
myButton.setFocus()
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top