本文整理汇总了Python中PyQt5.QtGui.QPalette.Base方法的典型用法代码示例。如果您正苦于以下问题:Python QPalette.Base方法的具体用法?Python QPalette.Base怎么用?Python QPalette.Base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QPalette
的用法示例。
在下文中一共展示了QPalette.Base方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def __init__(self, *, tabdata, win_id, private, parent=None):
super().__init__(parent)
self._win_id = win_id
self._tabdata = tabdata
theme_color = self.style().standardPalette().color(QPalette.Base)
if private:
assert webenginesettings.private_profile is not None
profile = webenginesettings.private_profile
assert profile.isOffTheRecord()
else:
profile = webenginesettings.default_profile
page = WebEnginePage(theme_color=theme_color, profile=profile,
parent=self)
self.setPage(page)
if qtutils.version_check('5.11.0', compiled=False, exact=True):
# Set a PseudoLayout as a WORKAROUND for
# https://bugreports.qt.io/browse/QTBUG-68224
# and other related issues. (Fixed in Qt 5.11.1)
sip.delete(self.layout())
self._layout = miscwidgets.PseudoLayout(self)
示例2: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def __init__(self):
super(VideoStyleLight, self).__init__()
palette = qApp.palette()
palette.setColor(QPalette.Window, QColor(239, 240, 241))
palette.setColor(QPalette.WindowText, QColor(49, 54, 59))
palette.setColor(QPalette.Base, QColor(252, 252, 252))
palette.setColor(QPalette.AlternateBase, QColor(239, 240, 241))
palette.setColor(QPalette.ToolTipBase, QColor(239, 240, 241))
palette.setColor(QPalette.ToolTipText, QColor(49, 54, 59))
palette.setColor(QPalette.Text, QColor(49, 54, 59))
palette.setColor(QPalette.Button, QColor(239, 240, 241))
palette.setColor(QPalette.ButtonText, QColor(49, 54, 59))
palette.setColor(QPalette.BrightText, QColor(255, 255, 255))
palette.setColor(QPalette.Link, QColor(41, 128, 185))
# palette.setColor(QPalette.Highlight, QColor(126, 71, 130))
# palette.setColor(QPalette.HighlightedText, Qt.white)
palette.setColor(QPalette.Disabled, QPalette.Light, Qt.white)
palette.setColor(QPalette.Disabled, QPalette.Shadow, QColor(234, 234, 234))
qApp.setPalette(palette)
示例3: dark_theme
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def dark_theme(app: QApplication):
app.setStyle('Fusion')
style = os.path.abspath("assets/styles/dark/style.css")
with open(style, "r") as f:
app.setStyleSheet(f.read())
palette = QPalette()
palette.setColor(QPalette.Window, QColor(0, 0, 0))
palette.setColor(QPalette.WindowText, QtCore.Qt.white)
palette.setColor(QPalette.Base, QColor(15, 15, 15))
palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
palette.setColor(QPalette.ToolTipBase, QtCore.Qt.white)
palette.setColor(QPalette.ToolTipText, QtCore.Qt.white)
palette.setColor(QPalette.Text, QtCore.Qt.white)
palette.setColor(QPalette.Button, QColor(20, 20, 20))
palette.setColor(QPalette.ButtonText, QtCore.Qt.white)
palette.setColor(QPalette.BrightText, QtCore.Qt.red)
palette.setColor(QPalette.Highlight, QColor(239, 74, 40).lighter())
palette.setColor(QPalette.HighlightedText, QtCore.Qt.black)
app.setPalette(palette)
示例4: cvstudio_theme
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def cvstudio_theme(app: QApplication):
app.setStyle('Fusion')
app.setStyle('Fusion')
style = os.path.abspath("assets/styles/cvstudio/style.css")
with open(style, "r") as f:
app.setStyleSheet(f.read())
palette = QPalette()
palette.setColor(QPalette.Window, QColor(0, 0, 0))
palette.setColor(QPalette.WindowText, QtCore.Qt.white)
palette.setColor(QPalette.Base, QColor(15, 15, 15))
palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
palette.setColor(QPalette.ToolTipBase, QtCore.Qt.white)
palette.setColor(QPalette.ToolTipText, QtCore.Qt.white)
palette.setColor(QPalette.Text, QtCore.Qt.white)
palette.setColor(QPalette.Button, QColor(20, 20, 20))
palette.setColor(QPalette.ButtonText, QtCore.Qt.white)
palette.setColor(QPalette.BrightText, QtCore.Qt.red)
palette.setColor(QPalette.Highlight, QColor(169, 3, 252).lighter())
palette.setColor(QPalette.HighlightedText, QtCore.Qt.black)
app.setPalette(palette)
示例5: open
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def open(self):
'''
Callback for image opening
'''
fileName, _ = QFileDialog.getOpenFileName(self, "Open File", QDir.currentPath())
if fileName:
self.imageLabel.adjustSize()
self.zoomInAct.setEnabled(True)
self.zoomOutAct.setEnabled(True)
self.normalSizeAct.setEnabled(True)
self.openAct.setEnabled(False)
self.solveAct.setEnabled(True)
self.solveGreenAct.setEnabled(True)
self.addImage('Base image', fileName, addMenu=True)
示例6: paintEvent
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def paintEvent(self, event):
"""Override paintEvent to draw the tabs like we want to."""
p = QStylePainter(self)
selected = self.currentIndex()
for idx in range(self.count()):
if not event.region().intersects(self.tabRect(idx)):
# Don't repaint if we are outside the requested region
continue
tab = QStyleOptionTab()
self.initStyleOption(tab, idx)
setting = 'colors.tabs'
if self._tab_pinned(idx):
setting += '.pinned'
if idx == selected:
setting += '.selected'
setting += '.odd' if (idx + 1) % 2 else '.even'
tab.palette.setColor(QPalette.Window,
config.cache[setting + '.bg'])
tab.palette.setColor(QPalette.WindowText,
config.cache[setting + '.fg'])
indicator_color = self.tab_indicator_color(idx)
tab.palette.setColor(QPalette.Base, indicator_color)
p.drawControl(QStyle.CE_TabBarTab, tab)
示例7: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def __init__(self):
application = QtWidgets.QApplication(sys.argv)
application.processEvents()
loginWindow = client.LoginWindow()
if settings.darkMode:
application.setStyle("Fusion")
palette = QPalette()
palette.setColor(QPalette.Window, QColor(53, 53, 53))
palette.setColor(QPalette.WindowText, QColor(255, 255, 255))
palette.setColor(QPalette.Base, QColor(25, 25, 25))
palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
palette.setColor(QPalette.ToolTipBase, QColor(255, 255, 255))
palette.setColor(QPalette.ToolTipText, QColor(255, 255, 255))
palette.setColor(QPalette.Text, QColor(255, 255, 255))
palette.setColor(QPalette.Button, QColor(53, 53, 53))
palette.setColor(QPalette.ButtonText, QColor(255, 255, 255))
palette.setColor(QPalette.BrightText, QColor(255, 0, 0))
palette.setColor(QPalette.Link, QColor(42, 130, 218))
palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
palette.setColor(QPalette.HighlightedText, QColor(0, 0, 0))
application.setPalette(palette)
loginWindow.show()
#new = rawscriptsmenu.ScriptsMenu()
#new.show()
sys.exit(application.exec_())
client.safeDisconnect()
开发者ID:HA6Bots,项目名称:Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader,代码行数:30,代码来源:init.py
示例8: main
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def main():
app = QApplication(sys.argv)
app.setStyle(QtWidgets.QStyleFactory.create("Fusion"))
p = app.palette()
p.setColor(QPalette.Base, QColor(40, 40, 40))
p.setColor(QPalette.Window, QColor(55, 55, 55))
p.setColor(QPalette.Button, QColor(49, 49, 49))
p.setColor(QPalette.Highlight, QColor(135, 135, 135))
p.setColor(QPalette.ButtonText, QColor(155, 155, 155))
p.setColor(QPalette.WindowText, QColor(155, 155, 155))
p.setColor(QPalette.Text, QColor(155, 155, 155))
p.setColor(QPalette.Disabled, QPalette.Base, QColor(49, 49, 49))
p.setColor(QPalette.Disabled, QPalette.Text, QColor(90, 90, 90))
p.setColor(QPalette.Disabled, QPalette.Button, QColor(42, 42, 42))
p.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90))
p.setColor(QPalette.Disabled, QPalette.Window, QColor(49, 49, 49))
p.setColor(QPalette.Disabled, QPalette.WindowText, QColor(90, 90, 90))
app.setPalette(p)
QApplication.addLibraryPath(QApplication.applicationDirPath() + "/../PlugIns")
main = Window()
main.setWindowTitle('Detection')
main.setWindowIcon(QtGui.QIcon('assets/icon.png'))
main.show()
try:
sys.exit(app.exec_())
except KeyboardInterrupt:
pass
示例9: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def __init__(self):
super().__init__()
self.setColor(QPalette.Window, QColor(56, 56, 56))
self.setColor(QPalette.WindowText, Qt.white)
self.setColor(QPalette.Base, QColor(56, 56, 56))
self.setColor(QPalette.AlternateBase, QColor(63, 63, 63))
self.setColor(QPalette.ToolTipBase, Qt.white)
self.setColor(QPalette.ToolTipText, Qt.white)
self.setColor(QPalette.Text, Qt.white)
self.setColor(QPalette.Button, QColor(56, 56, 56))
self.setColor(QPalette.ButtonText, Qt.white)
self.setColor(QPalette.BrightText, QColor(0, 128, 152))
self.setColor(QPalette.Link, QColor(42, 130, 218))
self.setColor(QPalette.Highlight, QColor(0, 128, 152))
self.setColor(QPalette.HighlightedText, Qt.white)
self.setColor(QPalette.Disabled, QPalette.Window, QColor(51, 51, 51))
self.setColor(QPalette.Disabled, QPalette.ButtonText,
QColor(111, 111, 111))
self.setColor(QPalette.Disabled, QPalette.Text, QColor(122, 118, 113))
self.setColor(QPalette.Disabled, QPalette.WindowText,
QColor(122, 118, 113))
self.setColor(QPalette.Disabled, QPalette.Base, QColor(32, 32, 32))
示例10: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def __init__(self, *args, **kwargs):
palette = self.palette()
if sys.platform == 'linux':
# KDE use the QPalette.Base as background color
palette.setColor(QPalette.Active, QPalette.Base, Qt.transparent)
palette.setColor(QPalette.Inactive, QPalette.Base, Qt.transparent)
# GNOME use the QPalette.Window as background color
palette.setColor(QPalette.Active, QPalette.Window, Qt.transparent)
palette.setColor(QPalette.Inactive, QPalette.Window, Qt.transparent)
else:
# macOS use the QPalette.Window as background color
palette.setColor(QPalette.Active, QPalette.Window, Qt.transparent)
palette.setColor(QPalette.Inactive, QPalette.Window, Qt.transparent)
self.setPalette(palette)
示例11: _draw_pixmap_overlay
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def _draw_pixmap_overlay(self, painter, draw_width, draw_height, scrolled):
painter.save()
rect = QRect(0, 0, draw_width, draw_height)
painter.translate(0, -scrolled)
gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft())
color = self.palette().color(QPalette.Base)
if draw_height == self.height():
gradient.setColorAt(0, add_alpha(color, 180))
gradient.setColorAt(1, add_alpha(color, 230))
else:
if self._app.theme_mgr.theme == Light:
gradient.setColorAt(0, add_alpha(color, 220))
gradient.setColorAt(0.1, add_alpha(color, 180))
gradient.setColorAt(0.2, add_alpha(color, 140))
gradient.setColorAt(0.6, add_alpha(color, 140))
gradient.setColorAt(0.8, add_alpha(color, 200))
gradient.setColorAt(0.9, add_alpha(color, 240))
gradient.setColorAt(1, color)
else:
gradient.setColorAt(0, add_alpha(color, 50))
gradient.setColorAt(0.6, add_alpha(color, 100))
gradient.setColorAt(0.8, add_alpha(color, 200))
gradient.setColorAt(0.9, add_alpha(color, 240))
gradient.setColorAt(1, color)
painter.setBrush(gradient)
painter.drawRect(rect)
painter.restore()
示例12: _draw_overlay
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def _draw_overlay(self, painter, draw_width, draw_height, scrolled):
painter.save()
rect = QRect(0, 0, draw_width, draw_height)
painter.translate(0, -scrolled)
gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft())
gradient.setColorAt(0, self.palette().color(QPalette.Window))
gradient.setColorAt(1, self.palette().color(QPalette.Base))
painter.setBrush(gradient)
painter.drawRect(rect)
painter.restore()
示例13: launch
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def launch():
# from utils.install_punkt import install_punkt
# install_punkt()
app = QApplication(sys.argv)
try:
file = sys.argv[1]
except IndexError: # File not given
file = get_last_file()
app.setStyle("Fusion")
palette = QPalette()
editor = configs[choiceIndex]["editor"]
ex = Main(app, palette, editor)
palette.setColor(QPalette.Window, QColor(editor["windowColor"]))
palette.setColor(QPalette.WindowText, QColor(editor["windowText"]))
palette.setColor(QPalette.Base, QColor(editor["editorColor"]))
palette.setColor(QPalette.AlternateBase, QColor(editor["alternateBase"]))
palette.setColor(QPalette.ToolTipBase, QColor(editor["ToolTipBase"]))
palette.setColor(QPalette.ToolTipText, QColor(editor["ToolTipText"]))
palette.setColor(QPalette.Text, QColor(editor["editorText"]))
palette.setColor(QPalette.Button, QColor(editor["buttonColor"]))
palette.setColor(QPalette.ButtonText, QColor(editor["buttonTextColor"]))
palette.setColor(QPalette.Highlight, QColor(editor["HighlightColor"]).lighter())
palette.setColor(QPalette.HighlightedText, QColor(editor["HighlightedTextColor"]))
app.setPalette(palette)
app.setStyleSheet(material_blue) # uncomment this to have a material blue theme
ex.show()
if file is not None:
ex.cleanOpen(file)
ex.openProjectWithPath(os.getcwd())
sys.exit(app.exec_())
示例14: gray_theme
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def gray_theme(app: QApplication):
# **** => copy this code ****
app.setStyle("Fusion")
style = os.path.abspath("assets/styles/gray/style.css")
with open(style, "r") as f:
app.setStyleSheet(f.read())
dark_palette = QPalette()
dark_palette.setColor(QPalette.Window, QColor(46, 47, 48))
dark_palette.setColor(QPalette.WindowText, QColor(208, 208, 208))
dark_palette.setColor(QPalette.Light, QColor(255, 255, 255))
dark_palette.setColor(QPalette.Midlight, QColor(227, 227, 227))
dark_palette.setColor(QPalette.Dark, QColor(64, 66, 68))
dark_palette.setColor(QPalette.Mid, QColor(160, 160, 160))
dark_palette.setColor(QPalette.Text, QColor(208, 208, 208))
dark_palette.setColor(QPalette.BrightText, QColor(255, 51, 51))
dark_palette.setColor(QPalette.Button, QColor(64, 66, 68))
dark_palette.setColor(QPalette.ButtonText, QColor(208, 208, 208))
dark_palette.setColor(QPalette.Base, QColor(46, 47, 48))
dark_palette.setColor(QPalette.Shadow, QColor(105, 105, 105))
dark_palette.setColor(QPalette.Highlight, QColor(0, 0, 0, 102))
dark_palette.setColor(QPalette.HighlightedText, QColor(255, 255, 255))
dark_palette.setColor(QPalette.Link, QColor(0, 122, 244))
dark_palette.setColor(QPalette.LinkVisited, QColor(165, 122, 255))
dark_palette.setColor(QPalette.AlternateBase, QColor(53, 54, 55))
dark_palette.setColor(QPalette.NoRole, QColor(0, 0, 0))
dark_palette.setColor(QPalette.ToolTipBase, QColor(0, 0, 0, 102))
dark_palette.setColor(QPalette.ToolTipText, QColor(208, 208, 208))
dark_palette.setColor(QPalette.Disabled, QPalette.Window, QColor(68, 68, 68, 255))
dark_palette.setColor(QPalette.Disabled, QPalette.WindowText, QColor(164, 166, 168, 96))
dark_palette.setColor(QPalette.Disabled, QPalette.Text, QColor(164, 166, 168, 96))
dark_palette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(164, 166, 168, 96))
dark_palette.setColor(QPalette.Disabled, QPalette.Base, QColor(68, 68, 68, 255))
dark_palette.setColor(QPalette.Disabled, QPalette.Shadow, QColor(0, 0, 0, 255))
app.setPalette(dark_palette)
app.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }")
示例15: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Base [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.setAttribute(Qt.WA_TranslucentBackground, True) # 设置父控件Widget背景透明
self.setWindowFlags(Qt.FramelessWindowHint) # 去掉边框
palette = self.palette()
palette.setBrush(QPalette.Base, Qt.transparent) # 父控件背景透明
self.setPalette(palette)
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
# QWebSettings.globalSettings().setAttribute(
# QWebSettings.DeveloperExtrasEnabled, True)# web开发者工具
self.webView = QWebView(self) # 网页控件
layout.addWidget(self.webView)
self.webView.setContextMenuPolicy(Qt.NoContextMenu) # 去掉右键菜单
self.mainFrame = self.webView.page().mainFrame()
self.mainFrame.setScrollBarPolicy(
Qt.Vertical, Qt.ScrollBarAlwaysOff) # 去掉滑动条
self.mainFrame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
# 最大化
rect = app.desktop().availableGeometry()
self.resize(rect.size())
self.webView.resize(rect.size())