Hi guys,
I would like to create a subclass of XlsxWriter in order to add new methods to semplify my work. For example, the script that I have in my mind, is written more or less in this way:
maybe what I should write to create my new class should be something like this:
I would like to create a subclass of XlsxWriter in order to add new methods to semplify my work. For example, the script that I have in my mind, is written more or less in this way:
# import my custom class (a subclass of xlsxwriter):
import XlsxWriterPlus as xwp
# create a workbook with the first sheet named "SHEET 1":
wb = xwp.Workbook("ciao.xlsx")
ws_1 = wb.add_worksheet("SHEET 1")
# use my custom method on the sheet object (ws_1):
a = ws_1.my_method(arg1, arg2, ..)
# now the object wb has his fisrt worksheet compiled as I wanted. I can close the excel file:
a.close()How can I reach my goal? Keep in mind that I didn't ever create a subclass of another one.. I'm working with the classes in these weeks. I just want to add new methods in xlsxwriter and use them in my scripts.maybe what I should write to create my new class should be something like this:
# import just what I need:
from xlsxwriter.worksheet import Worksheet
# create my subclass:
class XlsxWriterPlus(Worksheet):
def my_method(self, arg1, arg2, ..)
..
..
..
def my_method_2(self, arg1, arg2, ..)
..
..
..
def my_method_3(self, arg1, arg2, ..)
..
..
..what do you think? can you please give me a hand to understand better how to proceed?
