I am looking to change the background color of a button in my GUI application to default.After searching online, i saw that
button1.SetBackgroundColour(wx.NullColor) does not seem to work. I am using python 2.7.
Is there any other way I could set it to default color with out using system colors
A little late, but maybe someone else has the same problem.
Did you try
button1.SetBackgroundColour(wx.NullColour)
So, write "Colour" instead of "Color", the non-American writing. This worked for me.
If wx.NullColour doesn't work, a solution is to decode the RGB code for the colour you seek and apply it to your background.
E.g. the background color on my wx GUI is the light grey from Windows, its RGB code is R=240, G=240, B=240 (you can measure this using Paint for instance).
Then this should work:
button1.SetBackgroundColour(wx.Colour(240, 240, 240))
Of course if you want your GUI to be portable on other systems this isn't the best option since this light grey is only the default colour in Windows.
With Python 2.7.17 and wxPython 3.0.2.0 the following seems to work:
button1.SetBackgroundColour('')
I think that the solutions do not work because wxPython works with a style system. I was able to change foreground & background colours with the SetStyle method.
I was styling a wx.TextCtrl where I needed to highlight the text I search for.
First, I stored the existing colours to variables.
bc = self.te.GetBackgroundColour()
fc = self.te.GetForegroundColour()
self.bcol = wx.Colour(bc[0], bc[1], bc[2], bc[3])
self.fcol = wx.Colour(fc[0], fc[1], fc[2], fc[3])
Change the colours with SetStyle
self.te.SetStyle(x, y, wx.TextAttr(wx.BLACK, wx.LIGHT_GREY))
And reset it back to the original colours:
self.te.SetStyle(0, -1, wx.TextAttr(self.fcol, self.bcol))
Related
I am using Busy indicator to show intermediate progress and i want to change the color of the circles. I referred Customizing Busy indicator link but this is changing the default animation and other things. Also, It is difficult to understand because there is no explanation for the same.
I just want to change the color and the animations should be the same as default. please suggest.
Since the BusyIndicator actually just uses the palette.dark color, you can easily change it using the following code:
BusyIndicator {
palette.dark: "red"
}
Note that if you use the Material theme, you have to set the Material.accent color Material.accent: "red". And perhaps similar changes apply to other themes.
Fun fact: I found this by looking at the QML files in the Qt folder, for me: Qt/5.12.3/gcc_64/qml/QtQuick/Controls.2
I'm using gnuplot 5.0 with term qt - Qt terminal. Now, when I plot (or splot) whatever I want I have always to follow this post command
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb "white" behind
to set the background color to white. In fact, as default background color I have "black", so anytime I plot something, e.g.
set term qt
set pm3d
splot sin(x*y)
the output window has a black background, as below
Now, if i export the plot, it shows correctly the white background,
Since having an interactive term (such as qt) but can't interact with it is really annoying, the only possible way is to set manually the background color with the command set object or with the "Terminal configuration" tool, which anyway does not allow to change the color definitely
I've looked around, but nobody seems to know whether there's a command to change definitely the background color in qt terminal, so anytime I plot with tis term I have to change it manually.
Hope someone knows the solution!
Thx!
When you save a graph
gnuplot > save "test.plt"
and you open it, you will see that the file contains ALL the value for all the possible option for your graph.
Those information are the default of your graph and gnuplot under linux reads them in an hidden configuration file locate in the home and called .gnuplot
I suggest you to import to read this it gives you a nice one to use.
Using the above one as a model I created my personal one which is available here
I want to make a green button. I did this:
self.detectButton.setStyleSheet("background: #00ff00")
Here it was before the styling:
And after:
As you can see, the color changed, but the rounded corners were lost.
What's the proper way to style the color so the corners are not lost?
Secondarily, is there any way to get a theme-generic "ok" button color? This won't look the same on other platforms.
Do not use stylesheets if you want completely consistent results on all platforms. The reasons for this are explained in this answer.
If you only need to set the background colour, use the widget's palette:
palette = self.detectButton.palette()
palette.setColor(QtGui.QPalette.Button, QtGui.QColor('#00ff00'))
self.detectButton.setPalette(palette)
It seems unlikely that there's a systematic way to generate colours that work equally well on all platforms. Probably the best you can do is try to tweak one of the system colours that are accessible via the palette color roles.
EDIT:
It seems I was wrong to assume that the palette method is a reliable cross-platform solution. The Qt docs for QPalette has the following:
Warning: Some styles do not use the palette for all drawing, for
instance, if they make use of native theme engines. This is the case
for both the Windows XP, Windows Vista, and the OS X styles.
So it seems there isn't even a completely consistent, cross-platform way to do something as simple as changing the background colour.
I'm not familiar with Python, but I am assuming it removed all the other styles when you manually set that one.
I wonder if something like the following would work?
self.detectButton.setStyleSheet("background: #00ff00; border:1px solid #ccc; border-radius: 3px;")
It may have different syntax for multiple styles though.
I'm trying to make this zsh theme work: https://gist.github.com/3712874
I've made some small changes to it but there is still one problem. It seems that the right triangle glyph doesn't get the same color as the text background. See this image:
Any ideas why this might happen, and how to fix it?
I made it look pretty good. I had to go change the opacity of my colors. Instead of 100% I had to fiddle a bit and set them around 76-81% depending on what color it was.
I believe I switched to iTerm2 to fix this issue in the end.
Solution
On Linux using Terminal I had to change the Profile Preferences->Colors. For example, I wanted to use the theme dpoggi. I downloaded the theme image, then used the dropper tool to match the "red" "green", "cyan", and "magenta" that are used in the dpoggi source code.
dpoggi theme
Terminal Profile Preferences->Colors
I found that playing with the "Cursor guide" transparency in Preferences > Profiles worked for me. It can also be disabled.
I have a web page which has a picture. That picture has a color.
I need the hex code of the color in that picture. How can I get it?
Get Firefox. Get the ColorZilla plugin. Click on ColorZilla. Move over the color you want. Voila! You have the hexadecimal codes.
Another program to use is ColorPic.
ColorSchemer ColorPix is another good option. Light weight, and it gives you (among others) the RGB as well as the Hex for a given color.
The Internet Explorer developer toolbar (F12 in Internet Explorer 8) has a colour picker in the Tools menu that should help you.
Firefox has a few add-ons available that do the same thing.
If you want to do this in software, rather than manually, you could use a canvas element in supported browsers - draw the image on the canvas, then extract the colour information of the desired pixel. See this related question for how.
You can try Pixie from Nattyware. That is free and they also have a portable version.
Take a screenshot and open it in a regular or sophisticated paint application to get the color. Or better: download the picture and open it in a paint application.
Take a screenshot of the page, open it in Adobe Photoshop and select that color with the dropper tool.
The Color dialog will show you the hexadecimal code, the RGB color and the CYMK color code for that. You can do the same in GIMP if you don’t have Photoshop.