I created a analog rpm gauge using the canvas widget of Tkinter and I want to import it in a wx GUI application (as a panel, maybe). Is there any way to do it or I must rewrite this widget in wx?
There is no (simple) way to do that - WxWidgets is an abstraction over different toolkits in different systems, and use different mainloop functions, while Tkinter has its own mainloop - that is to start with.
So making that work would at leas require:
that you'd setup different threads able to run both mainloops in
paralell,
finding a way to get Tkinter to render the widget to an
in memory bitmap
create a custom widget in wx which would render
that bitmap to the screen
and map events on it back to Tkinter, if
it is supposed to respond events
So you are definitely better of writting the widget again.
WxPython has a speed meter widget just use that instead.
import wx.lib.agw.speedmeter
You would have to rewrite the widget in wxPython or find a widget that does the same thing that's already included with wx. Tkinter is a completely different GUI toolkit that draws its own widgets and is based on TCL whereas wxPython is a wrapper around wxWidgets which is based on C++. There is no easy way to embed a widget from Tkinter into wxPython.
As Yoriz mentioned, you might be able to use the speedmeter widget in wxPython. Check out the wxPython demo package as it will show you how to use that widget and most of wxPython's other widgets. Hopefully you can find something that's already included. Otherwise, you may want to take a look at the following page:
http://wiki.wxpython.org/CreatingCustomControls
Related
I wanted to ask if it is possible to draw a child window inside a parent window so that it will only be able to move inside the parent window and won't be able to move out of the parent window bounds.
If you mean having actual windows with title bar, menu, status bar etc. inside the parent window then the answer is:
No, Tcl/Tk and by extension Tkinter does not support this with its standard widgets.
There have been efforts in the past to implement widgets which emulate MDI as you can see on the TCL wiki, but most of them are over a decade old. You will probably have to implement it yourself or choose a different GUI toolkit if you really need to implement this kind of UI design.
If you do it yourself, you can use the Frame widget as the subwindow, and use place to put it in the containing window. Or, you can create it as an object on a canvas. You'll have to write all of the code to give the inner window borders and a title bar, and to manage moving it around, iconifying it, etc.
I wanted to ask if it is possible to draw a child window inside a parent window so that it will only be able to move inside the parent window and won't be able to move out of the parent window bounds.
If you mean having actual windows with title bar, menu, status bar etc. inside the parent window then the answer is:
No, Tcl/Tk and by extension Tkinter does not support this with its standard widgets.
There have been efforts in the past to implement widgets which emulate MDI as you can see on the TCL wiki, but most of them are over a decade old. You will probably have to implement it yourself or choose a different GUI toolkit if you really need to implement this kind of UI design.
If you do it yourself, you can use the Frame widget as the subwindow, and use place to put it in the containing window. Or, you can create it as an object on a canvas. You'll have to write all of the code to give the inner window borders and a title bar, and to manage moving it around, iconifying it, etc.
I want to develop an UI containing both forms for the user to configure the app and also a "render" part which will print some sprites for example.
Is it possible to combine PySide and PyGame in the same application? For example, how can i get a PySide Frame containing a Pygame application?
Thank you
The simplest, most natural solution is probably just to use a QGraphicsView. E.g. for sprites, implement a subclass of QGraphicsItem, and override the paint() function to display the appropriate frame.
If you absolutely insist on using PyGame, you could easily run the PySide and PyGame bits in separate windows. For embedding PyGame inside a PySide widget, it's probably going to be much harder, and the PySide widgets won't gel as seamlessly (you can actually stick GUI elements like buttons inside a QGraphicsView and transform them!).
I'd like to build a number of tkinter GUI apps and then stack them together either horizontally or vertically. I'd also like to navigate across the app easily once they become attached so that at any time I can focus on them.
One idea in my mind is that I can have a webpage like frame container, with a scrollbar, then drag other app's GUIs into it so that I can scroll across them.
To attach the windows, I understand that maybe I can get individual app's window through process info, but I just want to make sure if there is a built-in or better way of doing the things I want.
Seeing as you didn't capitalize tkinter, I'm going to assume that you are working in Python 3. If this is so, there are two options that I can think of: Using tkinter frames/grid geometry manager to place each widget side by side, and using tkinter.ttk Notebook to have multiple application tabs. you could also mess around with creating a scrollable tkinter Frame if you were dead set on the scrolling part, but from other Stackoverflow pages it appears that there is no native way to do that.
Example of tkinter.ttk Notebook
Does Tkinter or underlying Tk framework support the ability to apply the equivalent of the attributes() method to Frames vs. Windows?
Specifically: I have forms with a message area that I would like to fade away in jquery-like manner, eg. display a non-modal status message that fades away. I know I can fade a Tkinter window via window.attributes("-alpha", alpha), but I don't see an equivalent way to achieve this effect with a Frame. (I know I could place a top-level message window over my dialog, but coordinating the position and size of this window to match the layout of my dialog sounds complicated).
No, there is no way to do what you want. Tkinter only supports transparency on top-level windows.