[英]tkinter through VNC without physical display
我的設置是:
我是AFP-ed,SSH-ed和VNC-ed到我的RPi,我可以運行我寫的所有命令行腳本,也可以打開任何已安裝的GUI應用程序,但是,當我想運行tkinter時基於GUI的應用程序,以控制連接到GPIO的一些硬件,我有這樣的錯誤消息:
Client is not authorized to connect to ServerTraceback (most recent call last):
...
_tkinter.TclError: couldn't connect to display ":1"
我的猜測是,這與RPi沒有附加物理顯示的事實有關,雖然我不知道如何解決這種情況。
提前致謝!
我在RaspberryPi Stack Exchange網站上提出了這個問題 , @ hildred為此提供了一個漂亮的解決方案:
把這幾行etc/sudoers
*:
Defaults env_reset
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults env_keep += "DISPLAY"
Defaults env_keep += "XAUTHORITY"
這幾行到~/.bashrc
:
if [ -z "$XAUTHORITY" ]; then
if [ -e $HOME/.Xauthority ]; then
export XAUTHORITY=$HOME/.Xauthority;
fi;
fi
**在Raspbian上,這將是etc/sudoers.d/README
例如*
Raspberry Pi論壇上的一個人用tkinter解決了類似的問題 :
一個簡單的解決方法是為root提供使用X11連接的正確授權。 同樣,在LXTerminal窗口中:
pi@raspberrypi ~ $ sudo xauth add `xauth list`
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.