Skip to content

Instantly share code, notes, and snippets.

@peace098beat
Created August 10, 2016 00:11
Show Gist options
  • Save peace098beat/8ea9888715e0daf7cbe3f404ad8031db to your computer and use it in GitHub Desktop.
Save peace098beat/8ea9888715e0daf7cbe3f404ad8031db to your computer and use it in GitHub Desktop.
[pyside] ウィンドウスタイル
#! coding:utf-8
"""
Created by 0160929 on 2016/08/10 8:11
"""
import os
import sys
from PySide.QtGui import *
from PySide.QtCore import *
window_styles = (
'plastique', 'windows', 'motif', 'cde', 'plastique', 'cleanlooks', 'windowsxp', 'windowsvista', 'macintosh',
)
# おまじない
app = QApplication(sys.argv)
# Root Widget
root = QWidget()
# Buttons
funcs = []
# Lyaout
layout = QVBoxLayout(root)
layout1 = QHBoxLayout()
laytou2 = QHBoxLayout()
layout.addLayout(layout1)
layout.addLayout(laytou2)
for style in window_styles:
def func(s=style):
print s
app.setStyle(s)
textbox.setText(s)
# Button
b = QPushButton(style, root)
# Signal
b.clicked.connect(func)
# Add Layout
layout1.addWidget(b)
textbox = QLabel('fifi', root)
laytou2.addWidget(textbox)
combo = QComboBox(root)
laytou2.addWidget(combo)
c = [combo.addItem(item) for item in window_styles]
def combo_action(*args, **kwargs):
print args
print kwargs
s= combo.currentText()
app.setStyle(s)
combo.activated.connect(combo_action)
print c
root.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment