[英]How To Access a jupyter Notebook cell using a button click?
Can I access Jupyter Notebook Cell using tkinter desktop application ?我可以使用 tkinter 桌面应用程序访问 Jupyter Notebook Cell 吗? OR Can I past code in a cell on a button click ?或者我可以通过单击按钮在单元格中粘贴代码吗?
There is a module called subprocess
which you can use to open jupyter notebook along with tkinter.有一个模块调用subprocess
,你可以用它来打开jupyter笔记本Tkinter的一起。 Look at this code -看看这段代码——
import tkinter as tk
import subprocess
root = tk.Tk()
root.title('Jupyter Notebook')
def open_jup():
p = subprocess.Popen(["start", "cmd", "/k", "jupyter notebook"], shell = True)
button = tk.Button(root,text='OPEN Jupyter Notebook',command=open_jup)
button.pack(fill='both')
root.mainloop()
Subprocess.Popen
will open the cmd and run the jupyter notebook
and then, this will open the jupyter notebook in the browser This worked for me ! Subprocess.Popen
将打开 cmd 并运行jupyter notebook
,然后,这将在浏览器中打开 jupyter notebook 这对我有用! It can take some time the first time you run this.第一次运行它可能需要一些时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.