wxPython : change colour of a DataViewListCtrl item
I'm pretty new to building UIs, so I apologize if my question seems dumb in any way.
I'm currently building a small interface which aims at displaying a report depending on several entry parameters.
At first, I wanted the report to be shown through a wxListCtrl (LC_REPORT) but the problem I encountered is that I can't set the background or the font colour of a "Cell", I can only do it for the complete row. Maybe I'm mistaken tho.
Secondly, I found that I could show a report in a wxDataViewListCtrl, but I must admit I'm kind of lost within wxPython documentation (wxDataViewItem, wxDataViewItemAttr, etc).
Is there a way, once I built the report, to change some cells settings specifically?
python python-2.7 wxpython wxwidgets wxpython-phoenix
|
show 1 more comment
I'm pretty new to building UIs, so I apologize if my question seems dumb in any way.
I'm currently building a small interface which aims at displaying a report depending on several entry parameters.
At first, I wanted the report to be shown through a wxListCtrl (LC_REPORT) but the problem I encountered is that I can't set the background or the font colour of a "Cell", I can only do it for the complete row. Maybe I'm mistaken tho.
Secondly, I found that I could show a report in a wxDataViewListCtrl, but I must admit I'm kind of lost within wxPython documentation (wxDataViewItem, wxDataViewItemAttr, etc).
Is there a way, once I built the report, to change some cells settings specifically?
python python-2.7 wxpython wxwidgets wxpython-phoenix
The wxDataViewCtrl is complex and not well explained. Setting a background color for just a "cell" is anything but easy. I suggest to use awxGrid
. While it's also complex, it's much more easy to understand and deal with.
– Ripi2
Nov 19 '18 at 15:59
I might consider to do this, since I already used a wxGrid for another tool. But IIRC, in this case the first column is always not "editable", is it?
– ThylowZ
Nov 19 '18 at 16:04
@ThylowZ, what do you mean by first column?
– Igor
Nov 19 '18 at 19:47
If you are going to report in a table format with some additional text formatting, as suggestedwxGrid
is a good choice.
– macroland
Nov 20 '18 at 4:26
@Igor, sorry, I don't know how to explain it better, but last time I used wxGrid I had, by default, a first column which was sort of a "vertical header" (sorry I'm not native english) ==> I had both a vertical and a horizontal "header". Here, I need all my columns to be identical format-wise, in the same way as a listbox report. Dunno if it's more clear...
– ThylowZ
Nov 20 '18 at 9:20
|
show 1 more comment
I'm pretty new to building UIs, so I apologize if my question seems dumb in any way.
I'm currently building a small interface which aims at displaying a report depending on several entry parameters.
At first, I wanted the report to be shown through a wxListCtrl (LC_REPORT) but the problem I encountered is that I can't set the background or the font colour of a "Cell", I can only do it for the complete row. Maybe I'm mistaken tho.
Secondly, I found that I could show a report in a wxDataViewListCtrl, but I must admit I'm kind of lost within wxPython documentation (wxDataViewItem, wxDataViewItemAttr, etc).
Is there a way, once I built the report, to change some cells settings specifically?
python python-2.7 wxpython wxwidgets wxpython-phoenix
I'm pretty new to building UIs, so I apologize if my question seems dumb in any way.
I'm currently building a small interface which aims at displaying a report depending on several entry parameters.
At first, I wanted the report to be shown through a wxListCtrl (LC_REPORT) but the problem I encountered is that I can't set the background or the font colour of a "Cell", I can only do it for the complete row. Maybe I'm mistaken tho.
Secondly, I found that I could show a report in a wxDataViewListCtrl, but I must admit I'm kind of lost within wxPython documentation (wxDataViewItem, wxDataViewItemAttr, etc).
Is there a way, once I built the report, to change some cells settings specifically?
python python-2.7 wxpython wxwidgets wxpython-phoenix
python python-2.7 wxpython wxwidgets wxpython-phoenix
asked Nov 19 '18 at 15:40
ThylowZThylowZ
102
102
The wxDataViewCtrl is complex and not well explained. Setting a background color for just a "cell" is anything but easy. I suggest to use awxGrid
. While it's also complex, it's much more easy to understand and deal with.
– Ripi2
Nov 19 '18 at 15:59
I might consider to do this, since I already used a wxGrid for another tool. But IIRC, in this case the first column is always not "editable", is it?
– ThylowZ
Nov 19 '18 at 16:04
@ThylowZ, what do you mean by first column?
– Igor
Nov 19 '18 at 19:47
If you are going to report in a table format with some additional text formatting, as suggestedwxGrid
is a good choice.
– macroland
Nov 20 '18 at 4:26
@Igor, sorry, I don't know how to explain it better, but last time I used wxGrid I had, by default, a first column which was sort of a "vertical header" (sorry I'm not native english) ==> I had both a vertical and a horizontal "header". Here, I need all my columns to be identical format-wise, in the same way as a listbox report. Dunno if it's more clear...
– ThylowZ
Nov 20 '18 at 9:20
|
show 1 more comment
The wxDataViewCtrl is complex and not well explained. Setting a background color for just a "cell" is anything but easy. I suggest to use awxGrid
. While it's also complex, it's much more easy to understand and deal with.
– Ripi2
Nov 19 '18 at 15:59
I might consider to do this, since I already used a wxGrid for another tool. But IIRC, in this case the first column is always not "editable", is it?
– ThylowZ
Nov 19 '18 at 16:04
@ThylowZ, what do you mean by first column?
– Igor
Nov 19 '18 at 19:47
If you are going to report in a table format with some additional text formatting, as suggestedwxGrid
is a good choice.
– macroland
Nov 20 '18 at 4:26
@Igor, sorry, I don't know how to explain it better, but last time I used wxGrid I had, by default, a first column which was sort of a "vertical header" (sorry I'm not native english) ==> I had both a vertical and a horizontal "header". Here, I need all my columns to be identical format-wise, in the same way as a listbox report. Dunno if it's more clear...
– ThylowZ
Nov 20 '18 at 9:20
The wxDataViewCtrl is complex and not well explained. Setting a background color for just a "cell" is anything but easy. I suggest to use a
wxGrid
. While it's also complex, it's much more easy to understand and deal with.– Ripi2
Nov 19 '18 at 15:59
The wxDataViewCtrl is complex and not well explained. Setting a background color for just a "cell" is anything but easy. I suggest to use a
wxGrid
. While it's also complex, it's much more easy to understand and deal with.– Ripi2
Nov 19 '18 at 15:59
I might consider to do this, since I already used a wxGrid for another tool. But IIRC, in this case the first column is always not "editable", is it?
– ThylowZ
Nov 19 '18 at 16:04
I might consider to do this, since I already used a wxGrid for another tool. But IIRC, in this case the first column is always not "editable", is it?
– ThylowZ
Nov 19 '18 at 16:04
@ThylowZ, what do you mean by first column?
– Igor
Nov 19 '18 at 19:47
@ThylowZ, what do you mean by first column?
– Igor
Nov 19 '18 at 19:47
If you are going to report in a table format with some additional text formatting, as suggested
wxGrid
is a good choice.– macroland
Nov 20 '18 at 4:26
If you are going to report in a table format with some additional text formatting, as suggested
wxGrid
is a good choice.– macroland
Nov 20 '18 at 4:26
@Igor, sorry, I don't know how to explain it better, but last time I used wxGrid I had, by default, a first column which was sort of a "vertical header" (sorry I'm not native english) ==> I had both a vertical and a horizontal "header". Here, I need all my columns to be identical format-wise, in the same way as a listbox report. Dunno if it's more clear...
– ThylowZ
Nov 20 '18 at 9:20
@Igor, sorry, I don't know how to explain it better, but last time I used wxGrid I had, by default, a first column which was sort of a "vertical header" (sorry I'm not native english) ==> I had both a vertical and a horizontal "header". Here, I need all my columns to be identical format-wise, in the same way as a listbox report. Dunno if it's more clear...
– ThylowZ
Nov 20 '18 at 9:20
|
show 1 more comment
1 Answer
1
active
oldest
votes
You can definitely do what you want using the UltimateListCtrl widget. The wxPython demo even has an example of setting a single cell's background color to yellow. It looks like the items are of the following type: UltimateListItem
. These have a _colour
property that can be set.
The ObjectListView
also might be a solution that is worth looking at: https://objectlistview-python-edition.readthedocs.io/en/latest/recipes.html#how-can-i-change-the-colours-of-a-row
add a comment |
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%2f53378060%2fwxpython-change-colour-of-a-dataviewlistctrl-item%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can definitely do what you want using the UltimateListCtrl widget. The wxPython demo even has an example of setting a single cell's background color to yellow. It looks like the items are of the following type: UltimateListItem
. These have a _colour
property that can be set.
The ObjectListView
also might be a solution that is worth looking at: https://objectlistview-python-edition.readthedocs.io/en/latest/recipes.html#how-can-i-change-the-colours-of-a-row
add a comment |
You can definitely do what you want using the UltimateListCtrl widget. The wxPython demo even has an example of setting a single cell's background color to yellow. It looks like the items are of the following type: UltimateListItem
. These have a _colour
property that can be set.
The ObjectListView
also might be a solution that is worth looking at: https://objectlistview-python-edition.readthedocs.io/en/latest/recipes.html#how-can-i-change-the-colours-of-a-row
add a comment |
You can definitely do what you want using the UltimateListCtrl widget. The wxPython demo even has an example of setting a single cell's background color to yellow. It looks like the items are of the following type: UltimateListItem
. These have a _colour
property that can be set.
The ObjectListView
also might be a solution that is worth looking at: https://objectlistview-python-edition.readthedocs.io/en/latest/recipes.html#how-can-i-change-the-colours-of-a-row
You can definitely do what you want using the UltimateListCtrl widget. The wxPython demo even has an example of setting a single cell's background color to yellow. It looks like the items are of the following type: UltimateListItem
. These have a _colour
property that can be set.
The ObjectListView
also might be a solution that is worth looking at: https://objectlistview-python-edition.readthedocs.io/en/latest/recipes.html#how-can-i-change-the-colours-of-a-row
answered Nov 20 '18 at 14:39
Mike DriscollMike Driscoll
28.6k42774
28.6k42774
add a comment |
add a comment |
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%2f53378060%2fwxpython-change-colour-of-a-dataviewlistctrl-item%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
The wxDataViewCtrl is complex and not well explained. Setting a background color for just a "cell" is anything but easy. I suggest to use a
wxGrid
. While it's also complex, it's much more easy to understand and deal with.– Ripi2
Nov 19 '18 at 15:59
I might consider to do this, since I already used a wxGrid for another tool. But IIRC, in this case the first column is always not "editable", is it?
– ThylowZ
Nov 19 '18 at 16:04
@ThylowZ, what do you mean by first column?
– Igor
Nov 19 '18 at 19:47
If you are going to report in a table format with some additional text formatting, as suggested
wxGrid
is a good choice.– macroland
Nov 20 '18 at 4:26
@Igor, sorry, I don't know how to explain it better, but last time I used wxGrid I had, by default, a first column which was sort of a "vertical header" (sorry I'm not native english) ==> I had both a vertical and a horizontal "header". Here, I need all my columns to be identical format-wise, in the same way as a listbox report. Dunno if it's more clear...
– ThylowZ
Nov 20 '18 at 9:20