How to show dialogs like ColorPickerDialog in the main window not as a separate window
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I want to put the color picker dialog as part of the main window not as a dialog, (separate window).
The code below is shorter than the original one because I remove some parts to make it simple.
This is how it looks like.
I have removed the frames of the window to make it look like part of the main one, but when I click in the main window the other one minimizes. I would like it to be like a widget of the main window and not like a dialog window.
Thanks in advance.
import os
import sys
from PyQt4 import QtGui, QtCore
from win32api import GetSystemMetrics, GetMonitorInfo, MonitorFromPoint
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setWindowTitle("RGB APP")
self.setWindowIcon(QtGui.QIcon('')) #Pic.
self.toolBar = self.addToolBar("") # toolbar name
self.home()
self.show()
def home(self):
########################################################################
global Screen_width
Screen_width = GetSystemMetrics(0)
global Screen_height
Screen_height = GetSystemMetrics(1)
monitor_info = GetMonitorInfo(MonitorFromPoint((0, 0)))
monitor_area = monitor_info.get("Monitor")
work_area = monitor_info.get("Work")
global usablescreenheight
usablescreenheight=work_area[3]-30 #tittle bar takes 30px
global usablescreenwidht
usablescreenwidht=work_area[2]
# print("Height =", Screen_height)
# print("Width =", Screen_width)
self.setGeometry(0, 30, usablescreenwidht, usablescreenheight)
########################################################################
class ColorDialog(QtGui.QColorDialog):
def __init__(self, initial=QtGui.QColor(), parent=None):
super(ColorDialog, self).__init__(parent)
self.setOption(QtGui.QColorDialog.NoButtons)
self.setGeometry(5, usablescreenheight-303,1920,1080) #303 window size
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.home()
self.show()
def home(self):
colorpickerbackground = QtGui.QLabel(self)
colorpickerbackground.setGeometry(5, 30, usablescreenwidht-5*2, usablescreenheight-5*2-27)
def run():
app = QtGui.QApplication(sys.argv)
GUI = Window()
w=ColorDialog()
sys.exit(app.exec_())
run()
python python-3.x user-interface window pyqt4
add a comment |
I want to put the color picker dialog as part of the main window not as a dialog, (separate window).
The code below is shorter than the original one because I remove some parts to make it simple.
This is how it looks like.
I have removed the frames of the window to make it look like part of the main one, but when I click in the main window the other one minimizes. I would like it to be like a widget of the main window and not like a dialog window.
Thanks in advance.
import os
import sys
from PyQt4 import QtGui, QtCore
from win32api import GetSystemMetrics, GetMonitorInfo, MonitorFromPoint
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setWindowTitle("RGB APP")
self.setWindowIcon(QtGui.QIcon('')) #Pic.
self.toolBar = self.addToolBar("") # toolbar name
self.home()
self.show()
def home(self):
########################################################################
global Screen_width
Screen_width = GetSystemMetrics(0)
global Screen_height
Screen_height = GetSystemMetrics(1)
monitor_info = GetMonitorInfo(MonitorFromPoint((0, 0)))
monitor_area = monitor_info.get("Monitor")
work_area = monitor_info.get("Work")
global usablescreenheight
usablescreenheight=work_area[3]-30 #tittle bar takes 30px
global usablescreenwidht
usablescreenwidht=work_area[2]
# print("Height =", Screen_height)
# print("Width =", Screen_width)
self.setGeometry(0, 30, usablescreenwidht, usablescreenheight)
########################################################################
class ColorDialog(QtGui.QColorDialog):
def __init__(self, initial=QtGui.QColor(), parent=None):
super(ColorDialog, self).__init__(parent)
self.setOption(QtGui.QColorDialog.NoButtons)
self.setGeometry(5, usablescreenheight-303,1920,1080) #303 window size
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.home()
self.show()
def home(self):
colorpickerbackground = QtGui.QLabel(self)
colorpickerbackground.setGeometry(5, 30, usablescreenwidht-5*2, usablescreenheight-5*2-27)
def run():
app = QtGui.QApplication(sys.argv)
GUI = Window()
w=ColorDialog()
sys.exit(app.exec_())
run()
python python-3.x user-interface window pyqt4
self.setWindowFlags(QtCore.Qt.Widget, True)
.
– ekhumoro
Jan 4 at 14:09
add a comment |
I want to put the color picker dialog as part of the main window not as a dialog, (separate window).
The code below is shorter than the original one because I remove some parts to make it simple.
This is how it looks like.
I have removed the frames of the window to make it look like part of the main one, but when I click in the main window the other one minimizes. I would like it to be like a widget of the main window and not like a dialog window.
Thanks in advance.
import os
import sys
from PyQt4 import QtGui, QtCore
from win32api import GetSystemMetrics, GetMonitorInfo, MonitorFromPoint
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setWindowTitle("RGB APP")
self.setWindowIcon(QtGui.QIcon('')) #Pic.
self.toolBar = self.addToolBar("") # toolbar name
self.home()
self.show()
def home(self):
########################################################################
global Screen_width
Screen_width = GetSystemMetrics(0)
global Screen_height
Screen_height = GetSystemMetrics(1)
monitor_info = GetMonitorInfo(MonitorFromPoint((0, 0)))
monitor_area = monitor_info.get("Monitor")
work_area = monitor_info.get("Work")
global usablescreenheight
usablescreenheight=work_area[3]-30 #tittle bar takes 30px
global usablescreenwidht
usablescreenwidht=work_area[2]
# print("Height =", Screen_height)
# print("Width =", Screen_width)
self.setGeometry(0, 30, usablescreenwidht, usablescreenheight)
########################################################################
class ColorDialog(QtGui.QColorDialog):
def __init__(self, initial=QtGui.QColor(), parent=None):
super(ColorDialog, self).__init__(parent)
self.setOption(QtGui.QColorDialog.NoButtons)
self.setGeometry(5, usablescreenheight-303,1920,1080) #303 window size
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.home()
self.show()
def home(self):
colorpickerbackground = QtGui.QLabel(self)
colorpickerbackground.setGeometry(5, 30, usablescreenwidht-5*2, usablescreenheight-5*2-27)
def run():
app = QtGui.QApplication(sys.argv)
GUI = Window()
w=ColorDialog()
sys.exit(app.exec_())
run()
python python-3.x user-interface window pyqt4
I want to put the color picker dialog as part of the main window not as a dialog, (separate window).
The code below is shorter than the original one because I remove some parts to make it simple.
This is how it looks like.
I have removed the frames of the window to make it look like part of the main one, but when I click in the main window the other one minimizes. I would like it to be like a widget of the main window and not like a dialog window.
Thanks in advance.
import os
import sys
from PyQt4 import QtGui, QtCore
from win32api import GetSystemMetrics, GetMonitorInfo, MonitorFromPoint
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setWindowTitle("RGB APP")
self.setWindowIcon(QtGui.QIcon('')) #Pic.
self.toolBar = self.addToolBar("") # toolbar name
self.home()
self.show()
def home(self):
########################################################################
global Screen_width
Screen_width = GetSystemMetrics(0)
global Screen_height
Screen_height = GetSystemMetrics(1)
monitor_info = GetMonitorInfo(MonitorFromPoint((0, 0)))
monitor_area = monitor_info.get("Monitor")
work_area = monitor_info.get("Work")
global usablescreenheight
usablescreenheight=work_area[3]-30 #tittle bar takes 30px
global usablescreenwidht
usablescreenwidht=work_area[2]
# print("Height =", Screen_height)
# print("Width =", Screen_width)
self.setGeometry(0, 30, usablescreenwidht, usablescreenheight)
########################################################################
class ColorDialog(QtGui.QColorDialog):
def __init__(self, initial=QtGui.QColor(), parent=None):
super(ColorDialog, self).__init__(parent)
self.setOption(QtGui.QColorDialog.NoButtons)
self.setGeometry(5, usablescreenheight-303,1920,1080) #303 window size
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.home()
self.show()
def home(self):
colorpickerbackground = QtGui.QLabel(self)
colorpickerbackground.setGeometry(5, 30, usablescreenwidht-5*2, usablescreenheight-5*2-27)
def run():
app = QtGui.QApplication(sys.argv)
GUI = Window()
w=ColorDialog()
sys.exit(app.exec_())
run()
python python-3.x user-interface window pyqt4
python python-3.x user-interface window pyqt4
edited Jan 4 at 0:49
eyllanesc
87.1k103564
87.1k103564
asked Jan 3 at 22:34
Indrit BretiIndrit Breti
82
82
self.setWindowFlags(QtCore.Qt.Widget, True)
.
– ekhumoro
Jan 4 at 14:09
add a comment |
self.setWindowFlags(QtCore.Qt.Widget, True)
.
– ekhumoro
Jan 4 at 14:09
self.setWindowFlags(QtCore.Qt.Widget, True)
.– ekhumoro
Jan 4 at 14:09
self.setWindowFlags(QtCore.Qt.Widget, True)
.– ekhumoro
Jan 4 at 14:09
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030736%2fhow-to-show-dialogs-like-colorpickerdialog-in-the-main-window-not-as-a-separate%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030736%2fhow-to-show-dialogs-like-colorpickerdialog-in-the-main-window-not-as-a-separate%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
self.setWindowFlags(QtCore.Qt.Widget, True)
.– ekhumoro
Jan 4 at 14:09