本文整理汇总了Python中PyQt5.QtCore.Qt.FramelessWindowHint方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.FramelessWindowHint方法的具体用法?Python Qt.FramelessWindowHint怎么用?Python Qt.FramelessWindowHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.FramelessWindowHint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_button_4_clicked
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def on_button_4_clicked(self):
log.debug("clicked: B4: {}".format(self.winId()))
dialog_b4 = QDialog(flags=(Qt.Dialog | Qt.FramelessWindowHint))
ui = Ui_DialogConfirmOff()
ui.setupUi(dialog_b4)
dialog_b4.move(0, 0)
ui.buttonBox.button(QDialogButtonBox.Yes).setText("Shutdown")
ui.buttonBox.button(QDialogButtonBox.Retry).setText("Restart")
ui.buttonBox.button(QDialogButtonBox.Cancel).setText("Cancel")
ui.buttonBox.button(QDialogButtonBox.Yes).clicked.connect(self.b4_shutdown)
ui.buttonBox.button(QDialogButtonBox.Retry).clicked.connect(self.b4_restart)
dialog_b4.show()
rsp = dialog_b4.exec_()
if rsp == QDialog.Accepted:
log.info("B4: pressed is: Accepted - Shutdown or Restart")
else:
log.info("B4: pressed is: Cancel")
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, parent=None):
super(TextInput, self).__init__(parent)
self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)
self.mainLayout = QVBoxLayout()
self.textArea = QTextEdit(self)
self.buttonArea = QWidget(self)
self.buttonLayout = QHBoxLayout()
self.cancelButton = QPushButton('Cancel', self)
self.okButton = QPushButton('Ok', self)
self.buttonLayout.addWidget(self.cancelButton)
self.buttonLayout.addWidget(self.okButton)
self.buttonArea.setLayout(self.buttonLayout)
self.mainLayout.addWidget(self.textArea)
self.mainLayout.addWidget(self.buttonArea)
self.setLayout(self.mainLayout)
self.textArea.textChanged.connect(self.textChanged_)
self.okButton.clicked.connect(self.okButtonClicked)
self.cancelButton.clicked.connect(self.cancelPressed)
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, parent=None):
super(MessageArea, self).__init__(parent)
self.setReadOnly(True)
self.sender_format = _StandardTextFormat(Qt.gray, self.fontWeight())
self.time_format = _StandardTextFormat(Qt.gray, self.fontWeight())
self.text_format = _StandardTextFormat()
# styling
self.setWindowFlags(Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.viewport().setAutoFillBackground(False)
self.name_formats = {}
self.listeners = []
sound_filepath = path.join(path.dirname(__file__),
'resources',
'click.wav')
# sound_filepath = path.abspath(sound_filepath)
sound_filepath = QtCore.QUrl.fromLocalFile(sound_filepath)
self.sound = QtMultimedia.QSoundEffect()
self.sound.setSource(sound_filepath)
self.sound.setVolume(0.5)
self.sound.setLoopCount(1)
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, parent=None):
super(DesktopLyric, self).__init__()
self.lyric = QString('Lyric Show.')
self.intervel = 0
self.maskRect = QRectF(0, 0, 0, 0)
self.maskWidth = 0
self.widthBlock = 0
self.t = QTimer()
self.screen = QApplication.desktop().availableGeometry()
self.setObjectName(_fromUtf8("Dialog"))
self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.Tool)
self.setMinimumHeight(65)
self.setAttribute(Qt.WA_TranslucentBackground)
self.handle = lyric_handle(self)
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.font = QFont(_fromUtf8('微软雅黑, verdana'), 50)
self.font.setPixelSize(50)
# QMetaObject.connectSlotsByName(self)
self.handle.lyricmoved.connect(self.newPos)
self.t.timeout.connect(self.changeMask)
示例5: initWidgetsAndPack
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def initWidgetsAndPack(self, mainwidget, titlebar):
"""
将主体Widget和titleBar拼装起来
:param mainwidget:
:param titlebar:
:return:
"""
self.mainwidget = mainwidget
self.resize(mainwidget.width(), mainwidget.height() + Titlebar.TITLEBAR_HEIGHT)
self.setWindowFlags(Qt.FramelessWindowHint | self.windowFlags())
self.installEventFilter(titlebar)
# 布局: titlbar在上主窗体在下
pLayout = QVBoxLayout(self)
pLayout.addWidget(titlebar)
pLayout.addWidget(mainwidget)
pLayout.setSpacing(0) # 排列的几个widget为0间隔
pLayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(pLayout)
示例6: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, icon: str, parent=None):
super(Notification, self).__init__(parent)
self.parent = parent
self.theme = self.parent.theme
self.setObjectName('notification')
self.setContentsMargins(10, 10, 10, 10)
self.setModal(True)
self.setWindowFlags(Qt.Window | Qt.Dialog | Qt.FramelessWindowHint)
self.setMinimumWidth(550)
self.shown.connect(lambda: QTimer.singleShot(self.duration * 1000, self.close))
self._title, self._message = '', ''
self.buttons = []
self.msgLabel = QLabel(self._message, self)
self.msgLabel.setWordWrap(True)
logo_label = QLabel('<img src="{}" width="82" />'.format(icon), self)
logo_label.setFixedSize(82, 82)
self.left_layout = QVBoxLayout()
self.left_layout.addWidget(logo_label)
layout = QHBoxLayout()
layout.addStretch(1)
layout.addLayout(self.left_layout)
layout.addSpacing(10)
layout.addWidget(self.msgLabel, Qt.AlignVCenter)
layout.addStretch(1)
self.setLayout(layout)
示例7: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self):
super().__init__(parent=None)
self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.c = Container(self)
self._layout = QVBoxLayout(self)
self._layout.setContentsMargins(0, 0, 0, 0)
self._layout.setSpacing(0)
self._layout.addWidget(self.c)
self._old_pos = None
QShortcut(QKeySequence.ZoomIn, self).activated.connect(self.zoomin)
QShortcut(QKeySequence.ZoomOut, self).activated.connect(self.zoomout)
QShortcut(QKeySequence('Ctrl+='), self).activated.connect(self.zoomin)
QShortcut(QKeySequence.Cancel, self).activated.connect(self.hide)
self.setToolTip('''
* 右键可以弹出设置菜单
* Ctrl+= 或者 Ctrl++ 可以增大字体
* Ctrl+- 可以减小字体
* 鼠标前进后退键可以播放前一首/下一首
''')
示例8: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self,):
super().__init__(parent=None)
self._widget = None
self._timer = QTimer(self)
self._old_pos = None
self._widget = None
self._size_grip = QSizeGrip(self)
self._timer.timeout.connect(self.__on_timeout)
# setup window layout
self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
self._size_grip.setFixedSize(20, 20)
self._layout = QVBoxLayout(self)
self._layout.setContentsMargins(0, 0, 0, 0)
self._layout.setSpacing(0)
self._layout.addWidget(self._size_grip)
self._layout.setAlignment(self._size_grip, Qt.AlignBottom | Qt.AlignRight)
self.setMouseTracking(True)
示例9: auto_extract_clipboard
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def auto_extract_clipboard(self):
if not self.watch_clipboard:
return
text = self.clipboard.text()
pat = r"(https?://(\w[-\w]*\.)?lanzou[six].com/[bi]?[a-z0-9]+)[^0-9a-z]*([a-z0-9]+)?"
for share_url, _, pwd in re.findall(pat, text):
if share_url and not self.get_shared_info_thread.isRunning():
self.line_share_url.setEnabled(False)
self.btn_extract.setEnabled(False)
txt = share_url + "提取码:" + pwd if pwd else share_url
self.line_share_url.setText(txt)
self.get_shared_info_thread.set_values(txt)
self.tabWidget.setCurrentIndex(0)
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) # 窗口最前
self.show()
self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.WindowMinMaxButtonsHint) # 窗口恢复
self.show()
break
示例10: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, *args, stretch=1 / 3, direction=0, widget=None, **kwargs):
super(CDrawer, self).__init__(*args, **kwargs)
self.setWindowFlags(self.windowFlags(
) | Qt.FramelessWindowHint | Qt.Popup | Qt.NoDropShadowWindowHint)
self.setAttribute(Qt.WA_StyledBackground, True)
self.setAttribute(Qt.WA_TranslucentBackground, True)
# 进入动画
self.animIn = QPropertyAnimation(
self, duration=500, easingCurve=QEasingCurve.OutCubic)
self.animIn.setPropertyName(b'pos')
# 离开动画
self.animOut = QPropertyAnimation(
self, duration=500, finished=self.onAnimOutEnd,
easingCurve=QEasingCurve.OutCubic)
self.animOut.setPropertyName(b'pos')
self.animOut.setDuration(500)
self.setStretch(stretch) # 占比
self.direction = direction # 方向
# 半透明背景
self.alphaWidget = QWidget(
self, objectName='CDrawer_alphaWidget',
styleSheet='#CDrawer_alphaWidget{background:rgba(55,55,55,100);}')
self.alphaWidget.setAttribute(Qt.WA_TransparentForMouseEvents, True)
self.setWidget(widget) # 子控件
示例11: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, word):
super(NoMatch, self).__init__()
self.setWindowFlags(
Qt.Widget
| Qt.WindowCloseButtonHint
| Qt.WindowStaysOnTopHint
| Qt.FramelessWindowHint
)
self.layout = QHBoxLayout()
self.word = word
self.no_match = QLabel("No match found for word: {}".format(self.word))
self.ok_button = QPushButton("OK")
self.ok_button.setAutoDefault(True)
self.ok_button.clicked.connect(self.ok_pressed)
self.layout.addWidget(self.no_match)
self.layout.addWidget(self.ok_button)
self.setLayout(self.layout)
self.show()
示例12: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, parent, movable=False):
super().__init__()
self.setWindowFlags(
Qt.Widget
| Qt.WindowCloseButtonHint
| Qt.WindowStaysOnTopHint
| Qt.FramelessWindowHint
)
self.movable = movable
self.layout = QVBoxLayout()
self.pressed = False
self.process = QProcess()
self.parent = parent
self.clicked = False
self.name = None
self.process.readyReadStandardError.connect(self.onReadyReadStandardError)
self.process.readyReadStandardOutput.connect(self.onReadyReadStandardOutput)
self.setLayout(self.layout)
self.setStyleSheet("QWidget {background-color:invisible;}")
self.add() # Add items to the layout
# self.showMaximized() # comment this if you want to embed this widget
示例13: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.resize(428, 329)
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
# 这个是动画窗口,先创建不显示
self.flipWidget = FlipWidget()
self.flipWidget.finished.connect(self.showWidget)
# 登录窗口
self.loginWidget = LoginWidget(self)
self.loginWidget.windowClosed.connect(self.close)
self.loginWidget.windowChanged.connect(self.jumpSettingWidget)
self.addWidget(self.loginWidget)
# 设置窗口
self.settingWidget = SettingWidget(self)
self.settingWidget.windowClosed.connect(self.close)
self.settingWidget.windowChanged.connect(self.jumpLoginWidget)
self.addWidget(self.settingWidget)
示例14: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, *args, **kwargs):
super(NotificationWindow, self).__init__(*args, **kwargs)
self.setSpacing(20)
self.setMinimumWidth(412)
self.setMaximumWidth(412)
QApplication.instance().setQuitOnLastWindowClosed(True)
# 隐藏任务栏,无边框,置顶等
self.setWindowFlags(self.windowFlags() | Qt.Tool |
Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
# 去掉窗口边框
self.setFrameShape(self.NoFrame)
# 背景透明
self.viewport().setAutoFillBackground(False)
self.setAttribute(Qt.WA_TranslucentBackground, True)
# 不显示滚动条
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# 获取屏幕高宽
rect = QApplication.instance().desktop().availableGeometry(self)
self.setMinimumHeight(rect.height())
self.setMaximumHeight(rect.height())
self.move(rect.width() - self.minimumWidth() - 18, 0)
示例15: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import FramelessWindowHint [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
# 主屏幕的可用大小(去掉任务栏)
self._rect = QApplication.instance().desktop().availableGeometry(self)
self.resize(800, 600)
self.setWindowFlags(Qt.Window
| Qt.FramelessWindowHint
| Qt.WindowSystemMenuHint
| Qt.WindowMinimizeButtonHint
| Qt.WindowMaximizeButtonHint
| Qt.WindowCloseButtonHint)
# 增加薄边框
style = win32gui.GetWindowLong(int(self.winId()), win32con.GWL_STYLE)
win32gui.SetWindowLong(
int(self.winId()), win32con.GWL_STYLE, style | win32con.WS_THICKFRAME)
if QtWin.isCompositionEnabled():
# 加上 Aero 边框阴影
QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1)
else:
QtWin.resetExtendedFrame(self)