小编Kri*_*hna的帖子

iOS点按即可关注

我使用此代码在iOS自定义相机应用程序中实现Tap-to-Focus,但它无法正常工作.这是代码

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
    let touchPer = touches.anyObject() as UITouch
    let screenSize = UIScreen.mainScreen().bounds.size
    var focus_x = touchPer.locationInView(self.view).x / screenSize.width
    var focus_y = touchPer.locationInView(self.view).y / screenSize.height

    if let device = captureDevice {
        if(device.lockForConfiguration(nil)) {
            device.focusMode = AVCaptureFocusMode.ContinuousAutoFocus

            device.focusPointOfInterest = CGPointMake(focus_x, focus_y)
            device.exposureMode = AVCaptureExposureMode.ContinuousAutoExposure
            device.unlockForConfiguration()
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

ios avcapturesession swift

20
推荐指数
5
解决办法
9030
查看次数

Python - Mac OSX 10.10中的MySQL连接器错误

import mysql.connector

config = {
    'user' : 'root',
    'passwd' : ' ',
    'host' : 'localhost',
    'raise_on_warnings' : True,
    'use_pure' : False,
    }
cnx = mysql.connector.connect(**config)

cnx.close()
Run Code Online (Sandbox Code Playgroud)

我用这段代码来检查我使用mysql提供的安装程序安装的mysql包

我在终端运行文件,结果是,

Traceback (most recent call last):
 File "/Users/Krishna/Documents/check.py", line 1, in <module>
   import mysql.connector
ImportError: No module named 'mysql'
Run Code Online (Sandbox Code Playgroud)

非常感谢帮助.

mysql macos mysql-connector python-3.x mysql-connector-python

12
推荐指数
1
解决办法
7160
查看次数

使用Python阅读PDF并转换为PDF文本

我已使用此代码将pdf转换为文本。

input1 = '//Home//Sai Krishna Dubagunta.pdf'
output = '//Home//Me.txt'
os.system(("pdftotext %s %s") %( input1, output))
Run Code Online (Sandbox Code Playgroud)

我已经创建了Home目录,并将源文件粘贴到其中。

我得到的输出是

1
Run Code Online (Sandbox Code Playgroud)

并没有创建带有.txt的文件。问题出在哪里?

python pdftotext

2
推荐指数
2
解决办法
2万
查看次数