What kind of widget is this? - python

I am trying to make a widget exactly like this,
I want mine to be exactly the same (same font, picture, ect). Does anyone know how I can do this? I think it is a wx.ListCtrl but I cant find an example on how to make it look like this.
Can you provide me an example on how to make this widget?
Thanks.

It's a report list. Don't forget to keep a reference to the image list yourself since the bindings are stupid and don't incref it when you assign it to the list.

If the widget brings up different panels when you click on the image, then it's probably a Listbook, not a ListCtrl. Plus those are images from the wxPython demo for the Listbook AND the Toolbook AND the Treebook demos, so I'm guessing it's one of those.

Related

PyQt5, Letting Users resize the Widgets

I have developing an app for various different purposes with PyQt5 and it is going very well. I know how to resize a widget (like QLineEidit, or QTextBrowser), however, I would like to know how I would be able to allow the USER to resize these widgets to their liking. I'm sorry that I do not provide any code, I have not fully started this project, I would like to know if what I am trying to do is possible. It would be really helpful if you provided a small chunk of code that does this. Thank you in advance.
I'm not sure what exactly you are asking. You'd usually put your widgets in a layout, and then they resize when the user resizes the window.
You can also use a QSplitter so the user can resize two widgets relative to each other.
If you want the user to be able to resize any widgets in your window: I'm sure that'd be possible somehow, but I don't know how. However, that sounds like a rather bad UI to me.

Gtk HeaderBar doesn't expand children

I'm using Gtk to build an application on Linux using Python 3. I'm trying to use a Gtk.HeaderBar. So far it's been working Ok, but it seems that I can't get it to expand it's child widgets. For example:
As you can see above, I've tried putting my Gtk.Entry into the Gtk.HeaderBar, but even with things like Gtk.Entry.set_hexpand(True) it simply refuses to expand. I've even tried putting it inside a Gtk.Box, expanding the Gtk.Box, then adding the Gtk.Entry inside that. Even when I set the Gtk.Entry as a custom title for the Gtk.HeaderBar, this happens:
What's causing this? How can I fix it?
Enabling hexpand only says that you want the widget to be allocated all the remaining space; it does not actually resize your widget. You want the halign property set to GTK_ALIGN_FILL (or whatever it's called in Python) in addition to hexpand.
Check the diagrams on this page for a visual explanation.
You can use Box instead of Headerbar with window.set_titlebar method

Python Roguelike: Background Issue

I'm following a tutorial on making a roguelike in python, and it's actually coming along pretty nice. However, I have come to a small graphical issue: for the player and enemies, they all have a black background on them, which I don't want. I've tried changing the background to none anywhere I can, but I can't seem to figure out how to fix it. I'd really appreciate if anyone could help me out with this. Below is a link to an image showing this problem:
Also, if it helps, I'm using notepad++ and libtcod.
Thanks.
Hmm, you probably need to set the background flag. Or at least give it the proper color. So try to override it.
When you print a character it needs both foreground and background.
In any case you should probably look into object.draw() player.draw()
[SOLVED]
I found that I overlooked one of the parameters in the object.clear() event, and all I had to do was check if the object was visible, and if it has been explored yet to determine which background color to set it to.
Thanks to everyone who replied and gave their input!

wxPython: control navigation within wx.Lisbook wx.Panels

world!
I'd like to ask you one question, a simple solution (I guess) for a nerve-wracking problem I'm encountering using a wx.Lisbook component of wxPython.
In fact, I want to switch from a wx.Panel to another fluently, withou requiring a user input. I've already tried the SetFocus(), Show()/ShowWithEffect() + Hide()/HideWithEffect() methods, without great results.
Show()/Hide() gives the better results, but the selected Thumbnail remains the previous displayed panel...
Any idea of the method or good practice to manipulate wx.Listbook?
Thanks very much by advance for your answers!
Patrice
You want to be able to switch between panels? You should check out the various "Book" controls in wxPython, such as the Toolbook, Notebook, AUINotebook, etc. I also wrote a tutorial that's just on switching panels using the menu:
http://www.blog.pythonlibrary.org/2010/06/16/wxpython-how-to-switch-between-panels/
You could use a wx.Timer to do the switching too if you didn't want any user involvement.

How to add images/bitmaps to wx.Dialog

I want to add images to wx.Dialog (and then sizer) some like wx.ImageList and display it dynamically.
But I don't want to change already displayed image, I want to add next.
How can I resolve this problem?
I don't think a dialog is a good choice for a growing list of images, but if you have a good argument for that...
Anyway, you should be able to display your images using the wx.StaticBitmap widget. To add another one, use your sizer's Add method, then call the dialog's Layout() method and maybe its Refresh() method. If you plan on displaying many images, then you'll probably want to look at the ScrolledPanel or the ScrolledWindow widgets.

Categories

Resources