本文整理汇总了Python中PyKDE4.kdeui.KApplication.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Python KApplication.setStyle方法的具体用法?Python KApplication.setStyle怎么用?Python KApplication.setStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyKDE4.kdeui.KApplication
的用法示例。
在下文中一共展示了KApplication.setStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from PyKDE4.kdeui import KApplication [as 别名]
# 或者: from PyKDE4.kdeui.KApplication import setStyle [as 别名]
def main():
" Main Loop "
from getopt import getopt
OPAQUE = True
BORDER = True
try:
opts, args = getopt(sys.argv[1:], "hvob", ["version", "help", "opaque", "borderless"])
pass
except:
pass
for o, v in opts:
if o in ("-h", "--help"):
print(
"""
Usage:
-h, --help Show help informations and exit.
-v, --version Show version information and exit.
-o, --opaque Use Opaque GUI.
-b, --borderless No WM Borders.
Run without parameters and arguments to use the GUI.
"""
)
return sys.exit(1)
elif o in ("-v", "--version"):
print(__version__)
return sys.exit(1)
elif o in ("-o", "--opaque"):
OPAQUE = False
elif o in ("-b", "--borderless"):
BORDER = False
# define our App
try:
app = QApplication(sys.argv)
app.setApplicationName(__doc__)
app.setOrganizationName(__author__)
app.setOrganizationDomain(__author__)
app.setStyle("Plastique")
app.setStyle("Oxygen")
except TypeError:
aboutData = KAboutData(
__doc__,
"",
ki18n(__doc__),
__version__,
ki18n(__doc__),
KAboutData.License_GPL,
ki18n(__author__),
ki18n("none"),
__url__,
__email__,
)
KCmdLineArgs.init(sys.argv, aboutData)
app = QApplication()
app.lastWindowClosed.connect(app.quit)
# w is gonna be the mymainwindow class
w = MyMainWindow()
# set the class with the attribute of translucent background as true
if OPAQUE is True:
w.setAttribute(Qt.WA_TranslucentBackground, True)
# WM Borders
if BORDER is False:
w.setWindowFlags(w.windowFlags() | Qt.FramelessWindowHint)
# run the class
w.show()
# if exiting the loop take down the app
sys.exit(app.exec_())