Python:如何在不重复请求raw_input()的情况下保持while循环运行?

时间:2017-04-10 21:09:13

标签: python while-loop

我有以下的While循环,它会询问用户输入,然后在打印之前反复询问它' hello'。我想做的是向用户询问// Manually created context produces wrong shadow. let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedFirst.rawValue | CGBitmapInfo.byteOrder32Little.rawValue) if let ctx1 = CGContext(data: nil, width: Int(view.bounds.width * UIScreen.main.scale), height: Int(view.bounds.height * UIScreen.main.scale), bitsPerComponent: 8, bytesPerRow: Int(4 * view.bounds.width * UIScreen.main.scale), space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: bitmapInfo.rawValue) { ctx1.scaleBy(x: UIScreen.main.scale, y: -UIScreen.main.scale) ctx1.translateBy(x: 0, y: -view.bounds.height) view.layer.render(in: ctx1) guard let image = ctx1.makeImage() else { return } UIImageWriteToSavedPhotosAlbum(UIImage(cgImage: image), nil, nil, nil) } // Context created using UIGraphicsBeginImageContextWithOptions produces correct shadow. UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, UIScreen.main.scale) if let ctx2 = UIGraphicsGetCurrentContext() { view.layer.render(in: ctx2) guard let image = ctx2.makeImage() else { return } UIImageWriteToSavedPhotosAlbum(UIImage(cgImage: image), nil, nil, nil) // Manually created context with configurations copied from the "good" context still produces wrong shadow. if let ctx3 = CGContext(data: nil, width: ctx2.width, height: ctx2.height, bitsPerComponent: ctx2.bitsPerComponent, bytesPerRow: ctx2.bytesPerRow, space: ctx2.colorSpace!, bitmapInfo: ctx2.bitmapInfo.rawValue) { ctx3.concatenate(ctx2.ctm) view.layer.render(in: ctx3) guard let image = ctx3.makeImage() else { return } UIImageWriteToSavedPhotosAlbum(UIImage(cgImage: image), nil, nil, nil) } } 一次,然后运行while循环,而用户根本不需要输入任何内容并保持while循环运行直到用户输入{{1} }。

raw_input

0 个答案:

没有答案