Open strandlife opened 6 months ago
Thanks for the suggestion. This could be very difficult to achieve - especially the layout, as it's not clear how widget sizing would work in a canvas context. However, I can see how it could be useful (if nothing else, it would be one way to achieve a GUI layout editor).
Is it possible to implement the following codes?
context.rect.on_press = press
def press(widget, w, h):
# widget return rect . no canvas
bt_w = w
bt_h = h
Is it possible to move the widgets with the mouse? In Qt this can be done by simply enabling a simple feature. Will the feature (adding widgets to the canvas) be added to the program in the future?
Give that you can't add a widget to a canvas, I'm not sure why you'd be able to move them on a canvas...
As for whether this feature will be added in the future? Maybe.
Toga is an Open Source project, so it entirely depends on someone submitting a PR that implements the feature. I can't control anyone else's TODO list; but I can tell you it's not high on my own TODO list at the moment. It might be a higher priority for me in the future. If this is a high priority feature for someone else, then they are free to submit a PR, and someone from the project (possibly myself) will review that PR.
Our English is not good. It was difficult for us to write these messages... Anyway, thanks for your reply.
To make an interactive graphic environment, is there another solution in the Toga library?
What do you mean by PR?
A PR is a Pull Request - the mechanism by which you contribute to an open source project on Github. You can see the current list of open Toga pull requests here. These are features that core developers, and other community members have proposed for inclusion in Toga.
As for other options for building an interactive graphic environment - I can't offer any better options at present.
self.view.context.append(bt) error: AttributeError: 'Button' object has no attribute '_draw'
I need to see how to solve the above problem? I think I should request that they implement the _draw function for these widgets.
I'm afraid I don't have any insight for you here. _draw()
is the API that is used to render canvas drawing objects in a given context; however, I strongly suspect that won't be the mechanism that you need to use to add a widget to a canvas, because a widget isn't a 2D drawable. As I noted in my original comment - this will be a very difficult feature to achieve.
What is the problem or limitation you are having?
For a non-linear graphic editor, I need to add normal widgets to the canvas. In the Qt program, widgets in the canvas have more possibilities. Like clicking and moving. But canvas special widgets either don't have these facilities or we didn't find them...
Describe the solution you'd like
context.append(Button , Box, ....)
Describe alternatives you've considered
Rect.on_press = .....
Additional context
No response