Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1332|回复: 0
打印 上一主题 下一主题

cygwin 运行窗口程序

[复制链接]

697

主题

1142

帖子

4086

积分

认证用户组

Rank: 5Rank: 5

积分
4086
跳转到指定楼层
楼主
发表于 2018-2-27 10:25:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
https://www.cnblogs.com/bovenson/p/5118360.html
Version:0.9StartHTML:0000000164EndHTML:0000017096StartFragment:0000000200EndFragment:0000017060SourceURL:https://www.cnblogs.com/bovenson/p/5118360.html然后百度 cygwin tkinter display,出来的结果我只能用呵呵表示,最后还是用360搜索结合bing,慢慢理清的头绪
发现,如果想要运行窗口程序, 需要安装 x server.
可以选择xming x server,也就是cygwin/x
最新的cygwin/x 是集成在cygwin安装里的,在安装的时候选择安装程序的时候,添加xinit

我把xorg也选上了


完成安装后,我是用命令:
export DISPLAY=:0.0startx

结果异常退出,提示:

$/usr/bin/xterm: Xt error: Can't open display: :0.0

很奇怪,后来从http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-cannot-open-display  看到这么一句:
Some products that have been reported to cause problems:  Aventail Connect  Zonealarm PC Firewall from ZonelabNote: These products may not cause problems in all configurations. However, the Cygwin/X project has neither the time, ability, nor resources to help you correctly configure your third-party software.



吓得我赶紧把360那俩货关了,结果还是不行,看来是冤枉他们了,让后又360so,找到这么一句:
Cygwin doesn't automatically start an X server. You need to install the packages xorg-server and xinit, and run startxwin.
阿西吧,原来是用命令:
export DISPLAY=:0.0startxwin & #后面加上&就可以了继续在cygwin里面输入命令了,不出意外的话应该可以了,而且托盘会有xming的图标,可以从那退出

效果是这样的:

有x图标的那个就是x server

这是py.py运行的结果
startxwin &> x-server-log &export DISPLAY=:0.0



就可以把标准输出和标准错误输出重定向的文件s-server-log中,在cygwin控制台中,就看不到x server的输出信息

如果每次启动都需要启动x server
可以在~/.bashrc 中在最后添加两行代码:
export DISPLAY=:0.0startxwin &> x-server-log &






回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-4-29 09:14 , Processed in 0.054569 second(s), 19 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表