movable and resizable text edit control like in mspaint using wxpython - python

Hi I am trying to add some text to an image, and want adjust font, size, etc.
Is there any way to implement a mspaint style text input control in wxpython?
It have a rectangle area you can input text in it, and with 8 handler in 4 corner and 4 border to adjust size. I see many control like it in photoshop and other image process software.

Check out Whyteboard. I think it has one of those widgets and it's written in wxPython:
http://whyteboard.org/

Related

Python/Tkinter - Making The Background of a Textbox an Image?

Since Text(Tk(), image="somepicture.png") is not an option on text boxes, I was wondering how I could make bg= a .png image. Or any other method of allowing a text box to stay a text box, with an image in the background so it can blend into a its surroundings.
You cannot use an image as a background in a text widget.
The best you can do is to create a canvas, place an image on the canvas, and then create a text item on top of that. Text items are editable, but you would have to write a lot of bindings, and you wouldn't have nearly as many features as the text widget. In short, it would be a lot of work.

Send widgets content scaled to printer

I'm using QWidget.grab to get a pixmap containing what a component currently displays. It works perfectly apart from the size of the component not suitable for my printing requirements.
Is there a way so I can grab the pixmap of the component in a particular size?
QPixMap.grab() in Qt5 and QPixMap.grabWidget() in Qt4 get a pixmap of a painted widget in the screen resolution which is the natural painting resolution. Using the rectangle parameter you can even get parts of widgets.
The natural output resolution is the widgets own screen resolution. But afterwards you can scale it to anything you like via QPixMap.scaled() so that it fits your printing requirements.
It would actually be nice to change (simple scale) the painting resolution when grabing. But I don't know of any way to achieve this.

wxPython Transparent Frame - Display Text

I have followed the tutorial here: Transparent Frames
How can I make it so only the text from TextCtrl has 100% opacity while the rest of the window is invisible? What i mean is, I want an invisible window except for the text in TextCtrl.
I am on Windows 7, using python 2.7.
According to the tutorial you linked:
Only top-level controls can be transparent; no other controls can
A textctrl or statictxt, of course, is not a top level control.
There is this option, which I believe only works ontop of other opaque objects not on a transparent panel.
This shows how to draw an arbitrarily shaped window. If you combine (somehow) the above two, you should be able to get text against a transparent background. Other than that, good luck.

Achieving a facebook-like modal dialog in GTK+ (linux)

Ideally, the transparent border.
Here's an example of what i'd like to achieve:
Notice the transparent border.
Now i suppose I could use cairo to create a rectangle with transparency, and put a borderless non-transparent window inside, mimic'ing that effect - which I would if i knew the window would have a fixed dimension. However, if the inner window grows, it'll grow out of the transparent rectangle.
How should one approach such task?
Making window frames is really the job of the window manager (at least under X11, don't know how it works on windows).
But have a look at the GtkBin, GtkBox or GtkMisc widgets. Pack the dialog inside it as a single widget, and use padding to give it a size. Read up on GTK+ drawing model. You will probably need to set a flag and define your own expose-event handler to re-draw your frame.

Resizing frames in Tkinter

I have been making a small program with the Tkinter module in python, and I was wondering whether it was possible or not to resize a frame in my program with the mouse. As in, the user can drag the frame border and it will resize itself.
Your use of terminology makes the question unclear. Windows which may be resized by the user are called Toplevel windows. These are what appear as rectangular windows on the display, with a frame around them, typically a title bar, and edges or corners that can be grabbed and resized.
The term Frame refers to a container widget that must be inside a Toplevel or one of its descendents. A Frame has the ability to be resized but you have to write the code to let you interactively resize them. For example, you could place a little grip widget in one or more corners, and writing bindings to the press, motion and release of a mouse button.
Depending on the effect you are looking for, you might want a PanedWindow which is a container that includes a sash that lets you adjust the proportion of space between two other widgets.

Categories