LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-18-2010, 12:18 PM   #1
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
How to make a program that supports plugins?


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?
 
Old 08-18-2010, 01:15 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
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.
 
Old 08-19-2010, 10:17 AM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by Sergei Steshenko View Post
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.
How?

I can't find any good tutorials about this.
 
Old 08-19-2010, 10:36 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
How?

I can't find any good tutorials about this.
What "how" ? You take Python documentation and learn about 'import' and 'eval'.

As always, ask the first thing you do not understand in the official documentation.
 
Old 08-19-2010, 12:16 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
I don't understand how they can be used to achieve my goal.
 
Old 08-19-2010, 12:25 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
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.

Obviously, you can write widgets in PyQt.
 
Old 08-19-2010, 12:35 PM   #7
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
FWIW, entering

python eval

into Yahoo yields as the very first match

http://docs.python.org/library/functions.html
.

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.
 
Old 08-19-2010, 12:37 PM   #8
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
And you know what, just read the whole http://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'.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What kernel ver supports ReiserFS v.4? And how to make this fs. kornerr Linux - General 7 09-08-2007 02:00 AM
LXer: Free software program development environment supports CoreMP7 ... LXer Syndicated Linux News 0 08-23-2006 08:21 PM
program that supports voice chatting with msn? jimdaworm Linux - Software 5 08-03-2004 04:35 AM
Can anyone recommend and email program that supports http mail? Squall Linux - Software 1 03-19-2004 03:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration