unable to set menubar and title bar colour in qgis - python

I wanna change qgis mainwindow menubar's and titlebar's background and text colour using python plugin I used following code
qgis.mainWindow().setWindowTitle("mytitle")
qgis.mainWindow().setStyleSheet("
QMenuBar{
background-color:blue;
}
")
but this change only background of menubar but does effect on the menu option of the menu bar I wanna customize menu option text colour according to background colour.
I also want to change tilte bar colour please let me know the solotion

You can apply a dark theme to QGIS by going to Options > Application > UITheme and selecting Night Mapping.
If that's not how you like it, you can at least look at the nightmapping theming to see how it's done and tweak to your liking.
https://github.com/qgis/QGIS/blob/master/resources/themes/Night%20Mapping/style.qss

Related

Qt Designer how to change background

This is an repost.
I am kind of new in QtDesigner and wanted to do something about the uglyness of just some buttons.
All i have done yesterday was looking on the internet on how to change the background color of a screen in Qt Designer. How to change the color of a button and how to make it flow into another color on the sides. Guess what.
I found nothing.
I hope that some of you die-hard coders know what i need..
EDIT 1: What i mean with a color flowing into another:
Here pink flows into purple, do you get what I mean?
To make the changes of colors you can use stylesheets, in Qt Designer you must follow the following steps:
Right click on the item you want to change and select: change stylesheet
Then press the button to the color side and select background-color, Then select the color and press the OK buttons.
Output:
plus+:

Changing Font Color of wxpython Radio Button

I am using wxpython version 2.9.4.0 and python 2.7.9.
I am trying the change the color of the text for a radio button.
I initialized by:
button = wx.RadioButton(panel, -1, 'Line', (200, 300))
I was able to change the color around the radio button by:
button.SetBackgroundColour((150, 150, 150))
But this is not the behavior I want. I want to change the color of the text, not the area around it. I expected that changing the foreground colour would change the text color of the radio button, as that is how the color is changed for static text (as shown here Change the colour of a StaticText, wxPython). The code I used for this is:
button.SetForegroundColour((0, 255, 0))
However, for reasons unknown to me, this did not change anything about the radio button.
Am I mistaken that this command should change the text color of the radio button, and if so, what is the proper command?
Thanks in advance!
The SetForegroundColoour and SetBackgroundColour methods are not guaranteed to work. The reason is that wxPython uses the native widgets for the OS it is running on. If the native widget does not support changing the text's color, then these methods will have no effect. Some widgets allow changes to color on Mac while the same widgets on Windows do not.
If you really need to change text color in a radio button, then you'll probably need to create a custom widget. See the following:
http://wiki.wxpython.org/CreatingCustomControls
Use a wx.RadioButton with no label
&
put a wxStaticText next to it
and set your foreground colour as u wish

PyQt: How to find menu text color in that works with Ubuntu Unity?

I want to add colorless icons to menu items. To look reasonably, the icons should have the same color as the text used in the menu. It works everywhere except Ubuntu. The problem is that the default Ubuntu Unity theme uses different colors for the main menu and for other text (e.g. popup menus) in the application. I need the color specifically used by the main menu.
QApplication.palette().color(QPalette.Text) returns the dark gray color used by text in the application. It's almost invisible on the dark gray menu background.
I tried the palette() method on a QMenu descendant, but it returns the same value as QApplication.palette().
It turns out QMainWindow.menuBar().palette() has colors matching the Unity menu on top of the screen (I just learned it's called appmenu). That makes it possible to use the same color as the menu text.
But there is a problem. The version of the icon for the QtIcon.Active mode is not used for the active menu item. That can be seen in the high contrast mode. The text color changes, but the icon color doesn't. The icon "disappears" when the menu item is selected. That's not good enough for a polished program.
I tried many workarounds, such as adding extra pixmaps to the icon with QIcon.addPixmap(). Nothing works. The appmenu operates in a separate process and doesn't want to our "Active" icon. So I'm going to draw real icons that look good on any reasonable background and don't need to change color with the widget.
Too bad. I expected that the QIcon mode and state were made specifically for such tasks.

Change background color of python shell

Is it possible to change background color of the Python Shell from white to black for example. I did find how to change text color, but can't figure out how to change background color. I'm running it under the Windows. Any suggestions?
if you are refereeing to IDLE i did this simple steps from this link
(its for ubuntu but worked in windows as well)
http://ubuntuforums.org/showthread.php?t=657799
and if you are talking about the windows Prompt , you can use the color command or just right click & select properties & edit the color settings
Right-click the upper-left corner of the Python console window and select Properties.
In the dialog box that appears, pick the tab labeled Colors. On it you can set the screen background and text color.
If you are reffering to the window idle for example for version 2.6 there is now way to change the background color from withe to another one. But you can change the background color of your text if you go to options.
Another thing you can do is to use other gui for python which could be more elaborated such as eclipse pydev or to use a text editor you like and configure it the way you want to write your scripts and then run them into the idle.
just go through simple steps
- go to options
- configure IDLE
- highlighting
- then select background and click on choose color for:
- you can change the color to any color but becareful if u change only the background color the foreground color may not be visible because they both might be black
Enjoy
You can,,go to options then configure IDE, then on the settings window select highlights, on the rightside press the button below a builtin theme, then choose your choice theme

How can we change a wx.MenuBar background and foreground colour using wxpython?

I want to change the wxpython menubar colours.
How can I do it?
There are two ways
Hard way , write your own custom menu bar from PyControl, position it at top of window, and create popup windows for submenus.
Easier way: you can use win32api to change system menu colors for your app. Here is an example showing that http://code.activestate.com/recipes/440507-changing-the-background-color-of-the-menu-bar-in-a/
don't think it's doable -- it defaults to the platform's native look

Categories