我正在尝试使用compose通过单个函数创建2个面板:
make-panel: func [sentchar][
probe compose/deep [
text "N1:"
(to-set-word rejoin["fld1" sentchar ":"]) field ; TO BE NAMED fld1A and fld1B for 2 panels
text "N2: "
(to-set-word rejoin["fld1" sentchar ":"]) field ; TO BE NAMED fld2A and fld2B for 2 panels
text "Product: "
(to-set-word rejoin ["txt_out" sentchar ":"]) text ; TO BE NAMED txt_outA and txt_outB for 2 panels
button "Get product" [
x: to-path to-word (rejoin ["face/parent/pane/fld1" sentchar "/text"])
y: to-path to-word (rejoin ["face/parent/pane/fld2" sentchar "/text"])
(to-set-path …Run Code Online (Sandbox Code Playgroud) 我曾经使用以下命令运行程序:
docker run -ti \
--name wireshark \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/root/.Xauthority \
--privileged \
-d ubuntu:17.10 /bin/bash
Run Code Online (Sandbox Code Playgroud)
然后我可以使用Ubuntu系统的显示屏运行Wireshark。就像此页面的示例一样:使用docker运行GUI App
现在不起作用。当我运行wireshark时,出现以下错误:
root@5ad127a8333a:/# wireshark
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
QXcbConnection: Could not connect to display :0
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud) 我写了一堆产生GUI的代码.现在每当我运行代码时,它都会生成主GUI窗口和一个没有任何内容的小窗口.当我关闭较小的窗口时,大的主窗口消失.现在我一直在阅读其他类似问题的帖子,但我无法确定代码中的错误位置.
请帮忙 :)
跟进问题:如何添加背景图像而不是灰色无聊颜色?
#%% GUI Interface
import Tkinter as tk
from tkFont import Font
from PIL import ImageTk, Image
from Tkinter import END
#This creates the main window of an application
window = tk.Toplevel()
window.title("Sat Track")
window.geometry("1200x800")
window.configure(background='#f0f0f0')
#Imports the pictures.
pic1 = "Globeview.png"
pic2 = "MercatorView.png"
pic3 = "currentweathercroppedsmall.png"
pic4 = "GECurrentcroppedsmall.png"
#Creates a Tkinter-compatible photo image, which can be used everywhere Tkinter expects an image object.
img1 = ImageTk.PhotoImage(Image.open(pic1))
img2 = ImageTk.PhotoImage(Image.open(pic2))
img3 = ImageTk.PhotoImage(Image.open(pic3))
img4 …Run Code Online (Sandbox Code Playgroud) 在我的div元素中,我想放置两行。在第一行包含两个inputelements.For这个原因,我可以把那两个输入元素分成两个单独的列。
但是在第二行中,只有一个按钮元素,我不能放在两列中。这是我的代码。
<div id="app">
<div class="row">
<div class="col">
First name: <input type="text" name="" value="">
</div>
<div class="col">
Last name: <input type="text" name="" value="">
</div>
</div>
<div class="row">
<button type="button" name="button">Save</button>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
对于第二行而不是第二行,我必须将该按钮包装在列中。像这样
<div class="row">
<div class="col">
<button type="button" name="button">Save</button>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
还是我以前的代码很好?专业的方法是什么?我希望你能理解我的问题。谢谢。
我是tkinter和python的新手,我只想在特定位置的画布(带有背景图像)上放置“文本输入”小部件和“按钮”小部件,并使整个布局相对于窗口的大小。这是因为我会将gui设置为在不同的显示器上全屏显示,例如从宽屏到4:3的宽高比。但是我希望我的按钮和小部件保持其相对位置,此图说明了什么我的意思是:-https : //i.imgur.com/IMBuwkQ.png
不幸的是,我在使用pack和grid选项给我这个相对于Windows /屏幕尺寸的精确位置方面没有任何运气。是否有代码可以运行以返回我想要的位置,所以我可以在grid /打包以放置我的小部件?
因此,我开发了一些简单的python3代码来尝试完成此操作并具有以下功能:-(为方便起见,图像参考是在线的,因此该代码应立即运行,而不会在您选择的IDE中产生任何障碍)
from tkinter import*
from PIL import ImageTk, Image
import io
from io import BytesIO
import base64
import webbrowser
import urllib.request # not urllib.request
from PIL import Image, ImageTk
root = Tk()
root.geometry("1600x700+0+0")
url = "https://i.imgur.com/VqBbqpH.png" #use "direct link" from imgur, not "image link"
u = urllib.request.urlopen(url)
raw_data = u.read()
u.close()
im = Image.open(BytesIO(raw_data))
image = ImageTk.PhotoImage(im)
entryDefaultText="Enter Text"
class App(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.button = Button(master, text="Edit Box Details(click here)", …Run Code Online (Sandbox Code Playgroud) 我编写了一个简单的GUI,引导用户完成签出/签入过程,然后在用户单击GUI按钮时运行bash脚本.
我想在GUI中创建一个字段并显示脚本的输出.现在我正在使用system()(stdio)来运行脚本,但是将脚本的输出传递给我gui中的文本字段似乎很乱.
使用QProcess是一种更好的方法吗?如果是这样,我将如何开始?
另外,你会推荐什么Qt Widget /容器?
所以我正在制作一个记忆类型的游戏,问题是程序没有输入if语句,即使我知道它检查的值是相等的,因为我在if语句之前打印了两个值.它们都是1.我知道if语句因此而满足/为真.我知道它没有进入循环,因为我在循环中放置了一个print语句,并且没有看到控制台显示if语句.因此,我将发布一小段代码 - 我认为相关的代码,因为如果我发布整个代码,人们会生气.如果您需要整个代码,请告诉我,我会发布.无论如何,我打印到我的控制台的是:
1
1
注意声明如何:"圆形完成".什么时候应该没有.
这是代码:
else {
System.out.println(++numberOn);
System.out.println(currentPattern.size());
if (++numberOn==currentPattern.size()) {
System.out.println("Round finished.");
score++;
numberOn=0;
displayPattern();
}
else {
numberOn++;
}
}
Run Code Online (Sandbox Code Playgroud)
该程序正在100%输入这个大/第一个语句,否则前两个语句将不会运行.所以我需要知道为什么当双方彼此相等时,if语句第4行没有运行.提前致谢.
有一个选项可以在datatables.net网站上添加自定义按钮。如何在R Shiny应用中进行编码?一个按钮和观察者的基本R代码示例将非常有趣。
这是来自https://datatables.net/extensions/buttons/examples/initialisation/custom.html的 JS代码
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
{
text: 'My button',
action: function ( e, dt, node, config ) {
alert( 'Button activated' );
}
}
]
} );
} );
Run Code Online (Sandbox Code Playgroud)
谢谢 !
I am looking for ways to limit how much a user can resize the main window of my application, without preventing resizing completely. Specifically, I want to set minimum width and height for the window, and you'd think minWidth and minHeight would achieve this, but apparently they do not.
The root element of my window (declared in fxml) looks like this:
<VBox xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml"
fx:controller="com.my.module.FXMLController"
minWidth="400.0">
<!-- ... -->
</VBox>
Run Code Online (Sandbox Code Playgroud)
But all that minWidth seems to be doing is setting …