我正在尝试从以root身份运行的python systemd服务启动消息框。
body {
margin: 0;
}
.jumbotron{
align-items:center;
display:flex;
background-image:url('https://static.pexels.com/photos/392018/pexels-photo-392018.jpeg');
background-size:cover;
height:450px;
color:white;
height: 50vh;
}
* {
box-sizing: border-box;
}
.columns {
float: left;
width: 33.3%;
padding: 8px;
}
.columns2 {
float: left;
width: 33.3%;
padding-top: 70px;
}
.price {
list-style-type: none;
border: 1px solid #eee;
margin: 0;
padding: 0;
-webkit-transition: 0.3s;
transition: 0.3s;
}
.price:hover {
box-shadow: 0 8px 12px 0 rgba(0,0,0,0.2)
}
.price .header {
background-color: #2D2727;
color: white;
font-size: 25px;
}
.price li {
border-bottom: 1px solid #eee;
padding: 20px;
text-align: center;
}
.price .grey {
background-color: #eee;
font-size: 20px;
}
.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 25px;
text-align: center;
text-decoration: none;
font-size: 18px;
}
@media only screen and (max-width: 600px) {
.columns {
width: 100%;
}
}
.table{
color: black;
text-align:center;
}
.table th{
text-align:center;
}
我已经设置了环境变量DISPLAY和XAUTHORITY但是我仍然收到连接被拒绝消息
subprocess.Popen(["/usr/bin/zenity", "--info", "--text", "please reboot for changes to take effect"], env=dict(os.environ, DISPLAY="0.0", XAUTHORITY="/home/pi/.Xauthority"))
这里有什么我想念的吗?
答案 0 :(得分:1)
很可能是由于DISPLAY env var中的值不正确。尝试DISPLAY =“:0.0”
subprocess.Popen(["/usr/bin/zenity", "--info", "--text", "please reboot for changes to take effect"], env=dict(os.environ, DISPLAY=":0.0", XAUTHORITY="/home/pi/.Xauthority"))