0

I have a bokeh code that I open it with the terminal typing:

bokeh serve --show graph2d.py

how can I make a tkinter open this bokeh.py(graph2d.py)? Please help with this, I dont find how to make it work. this is the tkinter:

import tkinter as tk
from tkinter import *
import graph2d
"""import tkinter as Tk
from tkinter import ttk"""

window = Tk()

window.title("Welcome to PokerScatter app")

"""
WINDOW_SIZE = "600x400"
root = tk.Tk()
root.geometry(WINDOW_SIZE)
"""

selected = IntVar()

rad1 = Radiobutton(window,text='2d Scatter', value=1, variable=selected, command=graph2d)

rad2 = Radiobutton(window,text='3d Scatter', value=2, variable=selected)

rad3 = Radiobutton(window,text='Pie Chart', value=3, variable=selected)

rad4 = Radiobutton(window,text='Histogram', value=4, variable=selected)

def clicked():

   print("Processing")

btn = Button(window, text="Show", command=clicked)

rad1.grid(column=0, row=0)

rad2.grid(column=2, row=0)

rad3.grid(column=0, row=1)

rad4.grid(column=2, row=1)

btn.grid(column=6, row=0)

window.mainloop()
5
  • Embedding Bokeh server apps requires running JavaScript code. In order for a tkinter app to embed Bokeh content, it would have to have some method or widget for embedding HTML +JS, full stop. This answer seems to suggest that is possible, but you will just have to experiment (I have not used tkinter in 20 years, so I cannot comment any further). The Bokeh APIs for generating the JS embedding code are here. Commented Jun 27, 2022 at 22:31
  • hi, and with pyqt? could it be possible? Commented Jun 28, 2022 at 0:16
  • I have heard of people having success with qt. I believe there are a couple of questions and answers here on SO that you could search for. Commented Jun 28, 2022 at 13:17
  • I've searched ... and you seem the most active Commented Jun 28, 2022 at 14:20
  • I don't use Qt (I don't do any rich-client GUI dev and have not for a very, very long time). There is nothing I can add about Qt specifically, other than note the recollection that some people were successfull in embedding Bokeh in a Qt web widget at some point. FYI the Bokeh project only tests with actual browsers. It is "nice" if things work with rich-client GUI libraries, but to be clear, that is technically unsupported, "YMMV" territory. Commented Jun 28, 2022 at 15:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.