How To add new module plug and play features in Python Project - Python MagicStick Text Editor - Part 2

Namaste Friends,



To Make A Project More Reliable, Stable and stylish. New Add-on And Plugins Facility is very important. this feature is very important to make a software more user comfortable and customisable.  Hence, To make it more comfortable, good facility to handle external script is necessary.


This Is our Second part of Python MagicStick Text Editor Project and In this post, i will show you how to add plugin feature in any python project structure.That can handle external scripts easily.

But first, if you are a new visitor, Then I will suggest you to read our tutorial series number wise. because in this series i am showing how to use python tkinter module to create a real life application.

Links For Tutorials

MagicStick Text Editor Part 3
MagicStick Text Editor Part 4
MagicStick Text Editor Part 5
MagicStick Text Editor Part 6
MagicStick Text Editor Part 7
MagicStick Text Editor Part 8
MagicStick Text Editor Part 9
Or You Can Also Download Our Updated Example Codes Of Python MagicStick Text Editor Project For Understanding This Project More Clearly.

Check Here Our Github Repo




Now, let's focus to our main topic.

For Internal And External Functions Handling, We will Create a new script called "ConfigSettings.py". In this project, we will use this script like a connector between app and other functions. 

Now, Currently my directory structure look like this.


MagicStick_Editor_Part_1
 |
 |---> About.txt  
 |
 |---> magicsticklibs
 |  |
 |  |---> __init__.py
 |  |     
 |  |---> Main.py
 |  |            
 |  |---> TextPad.py
 |  |
 |  |---> Graphics.py
 |  |
 |               |---> ConfigSettings.py 
 |
 |
 |---> main.py


Now, We need to make a class in "ConfigSettings.py" for handling external script functions.


1. Write Below Code in "ConfigSettings.py"


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##
## ################################################
## ###### Please Don't Remove Author Name #########
## ############# Thanks ###########################
## ################################################
##
##
__author__='''

######################################################
                By S.S.B Group                          
######################################################

    Suraj Singh
    Admin
    S.S.B Group
    surajsinghbisht054@gmail.com
    http://bitforestinfo.blogspot.com/

    Note: We Feel Proud To Be Indian
######################################################
'''

class Connect:
 def __init__(self, pad):
  self.pad = pad
  self.modules_connections()


 def modules_connections(self):
  return

2. Modify "TextPad.py"



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
##
## ################################################
## ###### Please Don't Remove Author Name #########
## ############# Thanks ###########################
## ################################################
##
##
__author__='''

######################################################
                By S.S.B Group                          
######################################################

    Suraj Singh
    Admin
    S.S.B Group
    surajsinghbisht054@gmail.com
    http://bitforestinfo.blogspot.com/

    Note: We Feel Proud To Be Indian
######################################################
'''

from Graphics import Tkinter
from ConfigSettings import Connect

class TextPad(Tkinter.Text):
 def __init__(self, *args, **kwargs):
  Tkinter.Text.__init__(self, *args, **kwargs)
  self.storeobj = {}
  self.Connect_External_Module_Features()
  self._pack()

 def Connect_External_Module_Features(self):
  Connect(self)
  return

 def _pack(self):
  self.pack(expand = True, fill = "both")
  return



if __name__ == '__main__':
 root = Tkinter.Tk(className = " Test TextPad")
 TextPad(root)
 root.mainloop()


This Part Ends Here,

In Our Next Tutorial, We will continue this project


Written By
                   SSB

Share this

Related Posts

Previous
Next Post »