I was trying to find if its possible to add textctrl/combobox top of GenStaticBitmap in wxpython.
Did not find anything with the fast searches i did. Its not first in the priorities, but i feel like it would make the program usage better.
In this case i have screenshot taken from webpage and user can select inputbox and it should be textctrl over the bitmap positioned where it was selected. (i have it working already with textctrl positioned elsewhere).
# example something like this
self.staticbitmap = GenStaticBitmap(self.panel, self.bitmap)
text = wx.textctrl(self.panel)
# Have sizer position it here?
I can not give full code example.
Are you searching for something like a background bitmap (controls on top of a user-defined bitmap)?
Mike Driscoll has described a solution for this in his Blog.
Related
So i'm programming python program that uses wxPython for UI, with wx.TreeCtrl widget for selecting pictures(.png) on selected directory. I would like to add hover on treectrl item that works like tooltip, but instead of text it shows bitmap picture.
Is there something that already allows this, or would i have to create something with wxWidgets?
I am not too familiar with wxWidgets, so if i have to create something like that how hard would it be, lot of code is already using the treectrl, so it needs to be able to work same way.
So how would i have to go about doing this? And if there might be something i might be missing id be happy to know.
Take a look at the wx.lib.agw.supertooltip module. It should help you to create a tooltip-like window that displays custom rich content.
As for triggering the display of the tooltip, you can catch mouse events for the tree widget (be sure to call Skip so the tree widget can see the events too) and reset a timer each time the mouse moves. If the timer expires because the mouse hasn't been moved in that long then you can use tree.HitTest to find the item that the cursor is on and then show the appropriate image for that item.
I want to create buttons dynamically
self.ctset = wx.BitmapButton(panel, -1, self.pic1, pos=(10,10), size=(50,50))
self.ctset.Bind(wx.EVT_BUTTON, self.add_ct)
self.ctset.SetDefault()
and the add_ct binding function
def add_ct(self, event):
pos=(10,self.yct)
self.yct+=65
self.new = wx.BitmapButton(self, -1, self.pic1, pos=pos,size=(50,50))
self.new.SetDefault()
print "Cutset"
I don't know where I am going wrong but my dynamically created buttons always seem disabled!
I want to bind a function to the dynamically created buttons that allows me to drag them around. Any ideas would be of great help!
I am pretty new to python and wxpython.
I don't see any code that captures the mouse's coordinates or even any drag-and-drop code. You need to download the wxPython demo package from the wxPython website and look at the ShapedWindow example for catching mouse coordinates. See also this old thread: http://wxpython-users.1045709.n5.nabble.com/Drag-Button-around-a-Panel-td3358640.html
In it you will find someone who is doing something very similar to what you want. I also found the following links which you might find helpful:
Drag button between panels in wxPython
How to move items smoothly in wxPython?
I am looking for help - I am updating my Tkinter wiki (http://sourceforge.net/projects/infolder/) trying to add to it some folding/outline capabilities.
For it to work I need to place in the text widget (the main window where all the action happens) some un-deletable symbol indicating folding (e.g. a small triangle image indicating hidden text lines).
Unfortunately I noticed from these Q&A's that undeletable stuff is not easy to create in Tkinter:
How can you mark a portion of a text widget as readonly?
unremovable text in tkinter
As a 2nd option, I could try to show folding levels by a forced indent, so that e.g. if I'm at a one-level deep, the start-of-line is not at column 1 but at column 5...
This is it possible in Tkinter, without too much work?
thanks for any help...
Your question says that undeleteable regions are "not easy", but you also show they are possible by linking to an answer that shows how. So, what question are you asking?
As for "forced indent", look at the lmargin1 and lmargin2 tag attributes.
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.
I'm new to Python, but I can't really find much decent documentation on the web, so I'm hoping somebody will know the answer or where the answer is...
I have a wxPython FlexGridSizer bound to a panel that contains other FlexGridSizers, I'd like to display some cell borders on the main FlexGridSizer, so each section looks encapsulated but I can't find any documentation to do it.
I tried using a panel to add to my main FlexGridView, with the panel's border on, but the panel's border doesn't always fill up the entire FlexGridView cell, so it looks choppy and uneven.
Does anybody know how to properly simulate this?
Sizers are used just to organize widgets spatially, as a matter of a fact they are 'invisible'.
I think you're on the right track with putting a panel inside each cell and turning on it's borders. Try adding it with wx.EXPAND flag, it has a chance to help.
Concerning documentation:
wxPython is essentially a wrapper (well, with few extras) for the wxWidgets C++ library, so virtually everything you need can be found in wxwidgets documentation.
I find this documentation browser useful. And here are some notes on interpreting C++ documentation for wxPython users, but usually everything is obvious enough.
Also for borders you might be interested in wx.StaticBox or wx.StaticBoxSizer (that etched-line box around a group of controls, often with a label)