小编Ama*_*bić的帖子

更改noauth_local_webserver的默认状态?

我目前正在为我的社区制作一个GUI YouTube视频上传器,但由于我不希望我的所有用户都获得我的client_id和client_secret,我对它们进行了编码.问题是,无论何时程序运行(它不是从命令行使用参数运行,它从Tkinter GUI获取这些信息)它开始通过web链接验证用户,其中包含真正的client_id和client_secret.我尝试使用--noauth_local_webserver参数但没有成功,因为没有从命令行运行任何东西(我没有找到在没有命令行的情况下运行此参数的方法).正如我在官方文档上看到的那样,默认情况下此参数设置为"False",有没有办法改变它,或者有什么方法可以禁用Web身份验证?这是我用来验证和开始上传视频的代码(它几乎是官方文档中的默认代码,几乎没有变化,因此符合我的需求):

def get_authenticated_service():
    makeitreal() #this is function which decodes encoded client_id and client_secret
    flow = flow_from_clientsecrets(os.path.abspath(os.path.join(os.path.dirname(__file__), "client_secrets.json")), scope=YOUTUBE_UPLOAD_SCOPE,
    message=MISSING_CLIENT_SECRETS_MESSAGE)
    storage = Storage("%s-oauth2.json" % sys.argv[0])
    credentials = storage.get()

    if credentials is None or credentials.invalid:
       credentials = run(flow, storage)

    return build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,
      http=credentials.authorize(httplib2.Http()))

def initialize_upload():
    makeitreal() #this is function which decodes encoded client_id and client_secret
    youtube = get_authenticated_service()
    os.remove(os.path.join(os.path.dirname(__file__), "upload_video.py-oauth2.json")) #I use this to remove this json since it's not being used anymore and it contains client_id and client_secret
   tags …
Run Code Online (Sandbox Code Playgroud)

python google-api youtube-api oauth-2.0 google-oauth

6
推荐指数
1
解决办法
4317
查看次数

我可以更改Tkinter中的标题栏吗?

我正在使用Tkinter作为我的程序的GUI,但正如我所见,许多程序没有像Tkinter那样的标准外观.标准外观我的意思是标准标题栏,边框等.

例如,Tkinter的标题栏:

http://pokit.org/get/img/1a343ad92cd8c8f19ce3ca9c27afecba.jpg

vs GitHub的标题栏:

http://pokit.org/get/img/cf5cef0eeae5dcdc02f450733fd87508.jpg

看看他们如何拥有自己的自定义退出,调整大小和最小化按钮?是否有可能使用Tkinter实现这种外观?

提前致谢!:)

python tkinter

3
推荐指数
3
解决办法
8279
查看次数

检查某个 url 是否加载完成,然后在 WebView 中打开另一个

我想检查某个 URL 是否已完成加载,然后加载另一个 URL,如果该新 url 已完成加载,请执行某些操作,如何?

我知道如何检查某个 URL 是否已完成加载,如下所示:

webView.setWebViewClient(new WebViewClient() {

    public void onPageFinished(WebView view, String url) {
        // do stuff here
    }
    });
Run Code Online (Sandbox Code Playgroud)

但我想要的是:

 if url1 finished loading:
    load url2
    if url2 finished loading:
       //do some stuff here
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

java android android-webview webviewclient

3
推荐指数
1
解决办法
1222
查看次数