如何在pyqt5中设置快捷方式,以便可以从字符串变量中设置快捷方式?

时间:2019-09-27 10:30:44

标签: python pyqt pyqt5 keyboard-shortcuts

下面的代码无法激活快捷方式

print("hmmmmm",(s))
self.actionOpen.setShortcut(_translate("MainWindow", s))

打印输出为

hmmmmm Ctrl+Y

但是如果我直接给give打

print("hmmmmm",(s))
self.actionOpen.setShortcut(_translate("MainWindow", "Ctrl+Y"))

快捷方式有效

0 个答案:

没有答案