在哪里可以找到用于打印杯子的Pycups模块的文档?
我正在使用Python杯模块列出可用目的地。一切正常。我已经使用pycups
使用sudo apt-get安装pycups
。
import cups
conn = cups.Connection()
printers = conn.getPrinters()
for p in printers:
print(p)
print(printers[p],["device-uri"])
问题在于,我找不到该模块的文档,可以使用哪些方法,因此可以实现其他功能。
您有一个我可以在哪里找到文档的想法吗?
I am using the python cups module to list the available destinations. And everything work perfectly. I've installed the pycups
using sudo apt-get install pycups
.
import cups
conn = cups.Connection()
printers = conn.getPrinters()
for p in printers:
print(p)
print(printers[p],["device-uri"])
The problem is that I am not finding a documentation for this module and what are the methods that can be used so can implement other functionalities.
Do you have an idea where I can find the documentation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我遇到了同样的问题。有一个示例寻找。您可能应该与Python调试器一起戳戳,以了解图书馆的工作原理。
I ran into the same problem. There is one example in their github and that's all I could find. You should probably poke around with a python debugger to learn how the library works.
您可以在Python解释器中使用内置
帮助
函数:You can use built-in
help
function in python interpreter:您可以使用上述答案中提到的内置帮助功能。
这是使用Pycups PrintFile需要4个参数打印文件的示例
。
我通过了一个空词典,因为它是必要的,而且我正在使用第一个可用打印机
You can use the built-in help function mentioned in the above answer.
Here is an example of printing a file using pycups
printFile needs 4 parameters.
I passed an empty dictionary because it was necessary and also I am using the first available printer
Pycups-1.9.51的文档: 文档
Documentation for pycups-1.9.51: Documentation
关于选项参数,我经常使用:
{“侧面”:“双面长边”,“ prettyprint”:“ true”}
您可以在人页面中找到其他键,“常见的作业选项”部分:
-
man lpr
- localhost:631/help/help/hand man-lpr.html
About the options argument, I often use:
{"sides": "two-sided-long-edge", "prettyprint": "True"}
You can find other keys in man pages, "Common Job Options" section:
-
man lpr
- localhost:631/help/man-lpr.html
Pycups只是一座桥,您必须将其链接并使用。
创建一个Cups Conn对象,并使用带有该对象的Cups文档中可用的功能。
pycups is just a bridge, you have to link it and use.
Create a cups conn object and use the functions available in cups docs with that object.