python与C互相调用微全
2021/12/10 11:18:14
本文主要是介绍python与C互相调用微全,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
# C调用python. search(Calling Python Functions From C PyObject Py_XDECREF Py_XINCREF). # # SetWindowsHookEx,回调函数用Python写: https://www.cnblogs.com/funwithwords/p/15669613.html ctypes # 用SetConsoleTextAttribute设置文本颜色: https://www.cnblogs.com/funwithwords/p/15670028.html ctypes # # pip install pywin32 # import win32clipboard as w # import win32con # def get_text(): w.OpenClipboard(); s=w.GetClipboardData(win32con.CF_UNICODETEXT); w.CloseClipboard() # win32api.MessageBox(0,"msgbox", "title") # # pip install pyperclip 还有个wheel叫clipboard. # import pyperclip # pyperclip.copy('The text to be copied to the clipboard.') # pyperclip.paste() # # D:\Python39\Lib\site-packages\pythonwin\Pythonwin.exe 默认没有加入PATH. # D:\Python39\Lib\site-packages\pythonwin\pywin\Demos\*.py 大部分需要先运行pywin,再在pywin里运行.py # # >>> help(pywin) # PACKAGE CONTENTS # debugger (package) # dialogs (package) # docking (package) # framework (package) # idle (package) # mfc (package) # scintilla (package) # tools (package) # # First demo - use the built-in to Pythonwin "Tab Stop" dialog, but # customise it heavily. class TestDialog(dialog.Dialog): def __init__(self, modal=1): dialog.Dialog.__init__(self, IDD_SET_TABSTOPS) self.counter = 0 if modal: self.DoModal() else: self.CreateWindow() # 菜鸟MFC程序员都不知道无模式对话框呢 def OnInitDialog(self): self.SetWindowText("Used to be Tab Stops!") self.edit = self.GetDlgItem(IDC_EDIT_TABS) # the text box. self.edit.SetWindowText("Test") def OnDestroy(self, msg): del self.edit del self.counter import pywin.dialogs.list print(pywin.dialogs.list.SelectFromList('Select fruit', ['apple', 'grape', 'orange']))
这篇关于python与C互相调用微全的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-24Python编程基础详解
- 2024-11-21Python编程基础教程
- 2024-11-20Python编程基础与实践
- 2024-11-20Python编程基础与高级应用
- 2024-11-19Python 基础编程教程
- 2024-11-19Python基础入门教程
- 2024-11-17在FastAPI项目中添加一个生产级别的数据库——本地环境搭建指南
- 2024-11-16`PyMuPDF4LLM`:提取PDF数据的神器
- 2024-11-16四种数据科学Web界面框架快速对比:Rio、Reflex、Streamlit和Plotly Dash
- 2024-11-14获取参数学习:Python编程入门教程