我试图从Tkinter的Entry小部件中获取Text.它适用于Entry1.get(),但它不能使用textvariable
我究竟做错了什么 ?
from Tkinter import *
master = Tk()
v = StringVar()
def Entered(p1):
print 'Got: ', Entry1.get()
print 'Got: ', v.get()
Entry1 = Entry(master, text = '', width = 25, textvariable = v)
Entry1.pack()
Entry1.bind('<Return>', Entered)
Run Code Online (Sandbox Code Playgroud) 如何获取不是Component的Object的属性列表(在运行时).就像Grid Cell一样,它有自己的属性(Font,Align等).
网格如AdvStringGrid或AliGrid,或Bergs NxGrid.
使用Tkinter,我有很多按钮。我希望每次按下任何按钮时都触发相同的回调函数。我如何找出按下了哪个按钮?
def call(p1):
# Which Button was pressed?
pass
for i in range (50):
B1 = Button(master, text = '...', width = 2)
B1.grid(row = i*20, column = 60)
B1.bind('<Button-1>',call)
B2 = Button(master, text = '...', width = 2)
B2.grid(row = i*20, column = 60)
B2.bind('<Button-1>',call)
Run Code Online (Sandbox Code Playgroud) 我有几个同时在 Raspi 上运行的 python 脚本。根据当前时间,每个可能开始运行或停止运行。如何找出正在使用 Python 运行的脚本?
我想使用Delphi(7)的DOS命令显示目录的内容.使用Win10 - 64
以下程序显示DOS shell但不显示目录内容.我的代码出了什么问题?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, shellapi;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var i : integer;
begin
i := ShellExecute(Handle, nil, 'cmd.exe', PChar(' dir'), nil, SW_SHOW);
caption := inttostr(i);
end;
end.
Run Code Online (Sandbox Code Playgroud)