Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

端口输入框支持回车查询 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cube/port_spirit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def createWidgets(self):
self.label = Label(fr1, text='端口号/程序名:')
self.label.pack(side=LEFT, padx=3)
self.port_input = Entry(fr1)
# 绑定回车事件到处理函数
self.port_input.bind("<Return>", self.on_entry_return);

self.port_input.pack(side=LEFT, padx=6)
self.alert_button = Button(fr1, text='查询', width=6, command=self.search)
self.alert_button.pack(side=LEFT, padx=6)
Expand All @@ -52,6 +55,10 @@ def createWidgets(self):
self.table.heading("pid", text="进程号")
self.table.pack(side=LEFT, expand=YES, fill=BOTH)

## 端口输入框支持回车查询
def on_entry_return(self, event):
self.search();

## 查找端口的pid
def find_pro(self):
find_port = 'netstat -aon | findstr %s' % self.port_input.get()
Expand Down