Modular python code
- persei8
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 386
- Thank you received: 121
13 Oct 2018 20:32 #118751
by persei8
Modular python code was created by persei8
Let's say I wanted to modularize a large python file. I understand I can put certain modules in a directory where python can find them. However, is it possible to have gtk widget handlers stored in a file separate from the main one? I don't want to have dummy handlers that call the real ones in the other module. Thank you.
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
Less
More
- Posts: 7780
- Thank you received: 2075
14 Oct 2018 04:09 #118758
by cmorley
Replied by cmorley on topic Modular python code
gladeVCP, gscreen, Gmoccapy and QTvcp use a process of having 'the other file' as a class that can be parsed and it's functions added to the 'main file'. In gladevcp's case you can add many 'other file' (they are called handler files)
Not sure if you are familiar with any of those programs
It uses some black magic voodoo but it's not hard to copy.
In src/hal/user_comps/gladevcp.py look at the functions:
load_handlers and trampoline
Chris M
Not sure if you are familiar with any of those programs
It uses some black magic voodoo but it's not hard to copy.
In src/hal/user_comps/gladevcp.py look at the functions:
load_handlers and trampoline
Chris M
The following user(s) said Thank You: persei8
Please Log in or Create an account to join the conversation.
Time to create page: 0.051 seconds