R
R
Refiru2020-08-12 22:24:31
Python
Refiru, 2020-08-12 22:24:31

What is the best way to import the ctypes module?

Hello. Here is such a template code in the module.

# fox.py
fox = ctypes.CDLL(pathdll)
fox.CloseWindow.restype = None
fox.CloseWindow.argtypes = []

# main.py
# так мне его приходится импортировать
fox.CloseWindow()
# какие есть варианты избавится от fox ? в main.py мой вариант ниже
# он не очень удобен при объемном код

# fox.py
fox = ctypes.CDLL(pathdll)
fox.CloseWindow.restype = None
fox.CloseWindow.argtypes = []
def CloseWindow():
    fox.CloseWindow()
# main.py
CloseWindow()


Is there any way to make this code more concise?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question