ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Using PyQt4, is it possible to make a program where you can separately write custom QWidget subclasses and let the user add/remove them to your main app?
Using PyQt4, is it possible to make a program where you can separately write custom QWidget subclasses and let the user add/remove them to your main app?
I think the question is equivalent to the question about existence of dynamic compilation and linking in Python. I think that 'eval' and possibly 'import' are the positive answers.
I think the question is equivalent to the question about existence of dynamic compilation and linking in Python. I think that 'eval' and possibly 'import' are the positive answers.
I don't understand how they can be used to achieve my goal.
You can call 'import', 'eval' in from whatever place of executable Python code. The arguments to the function can (indirectly) be files containing code of the widgets you wish to link to your program - this is the answer to your "let the user add/remove them to your main app ?" question.
Find 'eval' in the page, read the description to the very end and show some useful curiosity in the context of the description, i.e. read about yet another function mentioned in the 'eval' description.
As before, you do not use WEB search and you do not read manuals.
And you know what, just read the wholehttp://docs.python.org/library/functions.html (i.e. in case of Perl I would say read the whole 'perldoc perlfunc') - just scrolling the page I've found yet another useful for the purpose functions - before 'eval'.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.