小编Art*_*ica的帖子

在Tkinter上显示全屏模式

如何在全屏模式下在Tkinter显示中制作画面?我看到了这段代码,它非常有用......:

>>> import Tkinter
>>> root = Tkinter.Tk()
>>> root.overrideredirect(True)
>>> root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
Run Code Online (Sandbox Code Playgroud)

...但是是否可以编辑代码以便命中 Esc 自动使窗口"恢复"?

python tkinter

38
推荐指数
5
解决办法
12万
查看次数

平台访问已禁用:由于更改了Facebook平台,访问暂时被禁用

我使用的是一个Web应用程序,要求用户代表他们发布权限.为此,我们调用FB登录窗口(https://www.facebook.com/v2.10/dialog/oauth)来请求权限.我们在范围内请求的权限是:

scope: 'public_profile, user_friends, read_insights, manage_pages, publish_actions, pages_manage_instant_articles, pages_messaging, publish_pages, ads_read, ads_management'
Run Code Online (Sandbox Code Playgroud)

一切都工作正常,直到今天我们开始收到此错误:

平台访问已禁用:由于更改了Facebook平台,访问暂时被禁用

我们启用了https,我们正在使用API​​的不推荐版本和对话.

我怎么解决这个问题?

facebook facebook-javascript-sdk

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

Python livewires调整大小屏幕

我正在尝试使用有多个级别的livewires创建游戏.在每个级别,屏幕将需要不同的大小,所以我可以创建一个新的屏幕,或者我可以调整它的大小.当我尝试新屏幕时,像这样(mcve):

from livewires import games
games.init(screen_width = 500, screen_height=100, fps = 50)
#dosomething
games.screen.quit()
games.init(screen_width = 100, screen_height=500, fps = 50)    
games.screen.mainloop()
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Traceback (most recent call last):
  File "C:\Users\Fred\Desktop\game\main.py", line 6, in <module>
    games.screen.mainloop()
  File "C:\Users\Fred\Desktop\game\livewires\games.py", line 308, in mainloop
    object._tick()
  File "C:\Users\Fred\Desktop\game\livewires\games.py", line 503, in _tick
    self.tick()
  File "C:\Users\Fred\Desktop\game\livewires\games.py", line 776, in tick
    self._after_death()
  File "C:\Users\Fred\Desktop\game\main.py", line 5, in <module>
    games.init(screen_width = 100, screen_height=500, fps = 50)
  File "C:\Users\Fred\Desktop\game\livewires\games.py", line 884, in init
    screen = Screen(screen_width, screen_height, fps) …
Run Code Online (Sandbox Code Playgroud)

python pygame livewires

8
推荐指数
1
解决办法
179
查看次数

React 根据另一个下拉列表选择值选择链接选项

使用 React Select Async 链接选项的最佳实践是什么。

我的意思是:我有 3 个下拉菜单,第一个下拉菜单使用默认选项值填充,接下来的 2 个下拉菜单被禁用。

选择第一个下拉列表值应根据其值填充第二个下拉列表选项,依此类推下一个下拉列表。

所以我一直在尝试

import React from "react";
import Select from "react-select";
import AsyncSelect from "react-select/async";
import classnames from "classnames";
import Requests from "../services/requests";

const filterOptions = (inputValue, options) => {
  return options.filter(i =>
    i.label.toLowerCase().includes(inputValue.toLowerCase())
  );
};

class FieldsRenderer extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      fields: props.fields,
      containerClass: props.containerClass,
      stepSnapshot: null,
      selectOptions: {}
    };

    this.props.fields.map( (f) => {
      if(f.type === 'select' && typeof f.dependsOn !== 'undefined') {
        this.state.selectOptions[f.name] = …
Run Code Online (Sandbox Code Playgroud)

html-select chained react-select

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

Tkinter 无法连接显示“:0”

我在一个项目中使用 tkinter,运行代码时收到消息

self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_ tkinter.TclError: couldn't connect to display ":0"

echo $DISPLAY returns :0
Run Code Online (Sandbox Code Playgroud)

我尝试过export DISPLAY=:0 和export DISPLAY=:0.0 但它不起作用。

我想在我打开的笔记本电脑的屏幕上显示 GUI(论坛上有关 ssh 的答案似乎无关)。

我在 Windows 上使用 ubuntu。我尝试过使用 python3 和 2.7,但收到相同的消息。

python tkinter

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

对话框中的用户输入

python中是否有任何库可用于图形用户输入。我知道,tk但是我相信这需要一些代码。我正在寻找最短的解决方案。

a = input('Enter your string here:') 
Run Code Online (Sandbox Code Playgroud)

代替此,我想获得一个对话框,以便用户可以在那里输入。

这没有达到目的。这仅显示对话框,您不能提供输入条目。

import ctypes  # An included library with Python install.   
ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 1)
Run Code Online (Sandbox Code Playgroud)

python user-interface tkinter python-3.x

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

Twilio 频道 - SMS 60200 无效参数错误(400 错误请求)

我在 Twilio API 中收到“400 - 错误请求”错误,但找不到原因。

这是我的要求:

curl --location --request POST 'https://verify.twilio.com/v2/Services/xxxxxxxxxxxxxx/Verifications' \
--header 'Authorization: Basic xxxxxxxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Channel=sms' \
--data-urlencode 'To=+44xxxxxxxxxx'
Run Code Online (Sandbox Code Playgroud)

我收到回复:

curl --location --request POST 'https://verify.twilio.com/v2/Services/xxxxxxxxxxxxxx/Verifications' \
--header 'Authorization: Basic xxxxxxxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Channel=sms' \
--data-urlencode 'To=+44xxxxxxxxxx'
Run Code Online (Sandbox Code Playgroud)

响应包含RequestID标头,但在 Twilio 门户中无法通过 查找错误RequestID

bad-request http-status-code-400 twilio-api

5
推荐指数
1
解决办法
2900
查看次数

嵌入新的黑色YouTube播放器

如何将新的黑色YouTube播放器嵌入我的网站(刚推出的那个)?

在此输入图像描述

我之前已经问过这个问题了,但是因为没有人在投票和关闭之前没有打算真正阅读这个问题而关闭了.不,我没有问如何嵌入播放器的V2或V3,我问的是刚推出的新版本.

PS:我是新人所以我不知道是否有人会重新打开我的另一个问题,或者它是否会永久关闭.随意删除其中一个问题,只要对方保持打开状态即可.

编辑:如果你不知道我在说什么,请阅读:http://newsinabox.net/1630/youtube-launched-cosmic-panda.html

youtube video-player

4
推荐指数
1
解决办法
1168
查看次数

检查tkinter窗口是否被撤回?

正如标题所示,是否可以检查 tkinter 窗口是否被撤回?

我知道这样一个事实,每当我撤回/取消图标化窗口时,我都可以切换 True/False 变量,但就我而言,这太混乱了。

python tkinter

4
推荐指数
1
解决办法
1046
查看次数

在 tkinter 的 Tk.after() 方法中使用 async/await 关键字

我正在使用 Python3.5 和 Tkinter 创建一个加密货币交换 API 客户端。我有几个显示,我想每 10 秒异步更新一次。我可以Tk.after()在这个例子中使用像每 10 秒更新一次显示

def updateLoans():
    offers = dd.loanOffers()
    demands = dd.loanDemands()
    w.LoanOfferView.delete(1.0, END)
    w.LoanDemandView.delete(1.0, END)
    w.LoanOfferView.insert(END, offers)
    w.LoanDemandView.insert(END, demands)
    print('loans refreshed')

    root.after(10000, updateLoans)
Run Code Online (Sandbox Code Playgroud)

为了使该after方法每 10 秒持续更新一次,该函数updateLoans()需要作为可调用对象传递到after()函数内部。

现在难倒我的部分,当我使这个函数与 python 的新 async 和 await 关键字异步时

async def updateLoans():
    offers = await dd.loanOffers()
    demands = await dd.loanDemands()
    w.LoanOfferView.delete(1.0, END)
    w.LoanDemandView.delete(1.0, END)
    w.LoanOfferView.insert(END, offers)
    w.LoanDemandView.insert(END, demands)
    print('loans refreshed')

    root.after(10000, updateLoans)
Run Code Online (Sandbox Code Playgroud)

这里的问题是我不能在after方法的参数中等待可调用对象。所以我收到运行时警告。RuntimeWarning: coroutine 'updateLoans' was never …

python tkinter python-3.x python-asyncio python-3.5

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