PyQt : give a color to all the textof an application - pyqt

I would like to change the look of my application in PyQt. I want all the text (in the buttons, labels and such) to be white for exampel, and all the buttons to be a certain color.
Can I change that all at once in the mainWindow ?
I did the following to change the background color of the whole app:
self.setStyleSheet("QMainWindow {background-color: #252526; color: #FFFFFF}")
If I set another stylesheet for the QPushButton for example in the same manner, the style for the QMainWindow will be overridden.

You could call the setStyleSheet() method on your QApplication instance and specify all object names in the CSS string:
app = QtGui.QApplication.instance()
app.setStyleSheet('QLabel{color: #fff;} QPushButton{background-color: #000; color: #fff}')

Related

Tabulator table: Change font

I'm trying to use the Tabulator table. Changing theme (including different .css), I get new background and foreground colors but the font is always times new roman. How do I change it ?
Use it like this:
.tabulator {
font-family: "Courier New";
}

Is it possible to set class to textbox using fabric.js

I want to add class to the textbox, how could I add that using fabric.js
canvas.set('class','textbox1');
Right now here i'm using canvas.set('class','textbox1'); for add any class.
Thanks In Advance.
I don't think it is necessary to use a class on a canvas element. Fabric.js has methods for their TextBox object with which you can style your component. The same goes for the Canvas object itself.
http://fabricjs.com/docs/fabric.Canvas.html
http://fabricjs.com/docs/fabric.Textbox.html
Fabric doesn't appear to have a Class option and CSS has no effect on canvas objects anyway.
So, if you wanted to set the background color of your TextBox you would do the following:
var t1 = new fabric.Textbox('My Text', {
width: 200,
top: 5,
left: 5,
fontSize: 16,
textAlign: 'center',
backgroundColor:'rgb(200,200,200)'
});

How can i set min-width size for my sub-window in Vaadin?

In my Vaadin code I want to add min-width feature to my sub-window.
I set width of my subwindow size %25 of my mainwindow, but I don't want it to be very small.I want it at least "125px". How can i set this with java code?
public class Awindow extends Window{
...
public Awindow(...)
setModal(true);
setCaption("Hello");
this.setHeight("100%");
this.setWidth("25%");// I don't want it to be %25 all the time,I want it to remain still after "150px".
VerticalLayout layout = new VerticalLayout (
memberTable,
new HorizontalTable(
createButton,
eraseButton)
);
layout.setSpacing(true);
...
this.setContent(layout);
The only possible solution i know is to make it with css.
You can add a css for the .v-window class eg:
.v-window {
min-width: 125px !important;
}
If you want fully programically
1) add your css style to page style with programmically
UI.getCurrent().getPage().getStyles().add(".min125px{min-width: 125px !important;}");
2) add this style (min125px) to your buttons
createButton.addStyleName("min125px");
eraseButton.addStyleName("min125px");
As long as https://github.com/vaadin/framework/issues/1360 is not implemented by Vaadin, you might want to check out the following add-on: https://vaadin.com/directory#!addon/restrain. This does essentially the same as proposed by the other answers, but has a nice server side api.
E.g.:
new Restrain(component).setMinWidth("125px");

How to add different color to odd and even rows in a pygtk TreeView

I have created a pygtk TreeView and wanted to add different colors between each line. I went here and it says that there exists a TreeView Style property that does exactly the same.The property is called 'odd-row-color' and 'even-row-color'. So went to my code and tried to apply this by using the set_property(). But i get an error message for doing that
self.customer_view.set_property('even-row-color', gtk.gdk.Color(211, 211, 211))
TypeError: object of type `GtkTreeView' does not have property `even-row-color'
How can achieve that. And where is that property handled?
You can use css (GTK3) to change the colors, something like:
style_provider = Gtk.CssProvider()
css = '''
GtkTreeView row:nth-child(even) { background-color: shade(#base_color, 0.9); }
GtkTreeView row:nth-child(odd) { background-color: shade(#base_color, 1.0); }
'''
style_provider.load_from_data(css.encode('utf8'))
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
Make sure to tell GTK that you want to paint alternate colors:
treeview.set_rules_hint(True)

Is there an easy way to give a MediaWiki wiki page a specific background colour?

We're looking to give pages in a specific category a specific background colour. Since every page in this category makes use of a specific template, we're ideally looking for a template change.
Can this be done?
Use the PageCSS extension, you should be able to put the css in your template, which would then apply to the pages it is on.
example:
<css>
#bodyContent { background-color: yellow; }
</css>
For the MediaWiki 1.18, you only need CSS and this code:
{{#css:
#bodyContent { background-color: yellow; }
body {
background: navajowhite;
}
}}
This will give the part of the page with text a yellow colour and the rest (border) a brown-ish colour.
For best results, put this in a template, e.g. {{Page colour}}, so that it can be called with, e.g. {{Page color|red|yellow}}. The template code will then be:
{{#css:
#bodyContent { background-color: {{{1|yellow}}}; }<!-- Page color -->
body {
background: {{{2|navajowhite}}};<!-- Border color -->
}
}}
where 1 & 2 are parameters (page and border respectively) with default colours (yellow and brownish).

Resources