0

I want to integrate IntRangeSlider from ipywidgets with wxpython dekstop application. I tried using widgets.IntRangeSlider() and interact() both separately but program is not executing. How to use these excellent functionalities with wx?

Code Example Here

Official page of ipywidgets with examples

import wx
from ipywidgets import *
class MyPanel(wx.Panel):
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)
        self.vert_box = wx.BoxSizer(wx.VERTICAL)
        rangeslider = widgets.IntRangeSlider(
            value=[5, 7],
            min=0,
            max=10,
            step=1,
            description='Test:',
            disabled=False,
            continuous_update=False,
            orientation='horizontal',
            readout=True,
            readout_format='d',
        )
        self.vert_box.Add(rangeslider, 0, wx.ALIGN_CENTER | wx.ALL, 1)

        rangeslider2=  interact(self.update)
        self.vert_box.Add(rangeslider2, 0, wx.ALIGN_CENTER | wx.ALL, 1)

        self.SetSizer(self.vert_box)
        self.Refresh()
    def update(self, w = 1.0):
        print("here is slider code")
        
class MyFrame(wx.Frame):
    def __init__(self):
        """Constructor"""
        wx.Frame.__init__(self, None, title='Test', size=(750, 550))
        panel = MyPanel(self)
        self.Show()

if __name__ == '__main__':
    app = wx.App(False)
    frame = MyFrame()
    app.MainLoop()
Akshada
  • 65
  • 7
  • 1
    I don't think you can do this easily. Ipywidgets are designed to be used with Jupyter notebooks, JupyterLab and IPython Kernel. Ipywidgets has its own layouts and grid systems that are not compatible with WXWidgets. – Dan A.S. Jul 06 '20 at 13:01
  • @DanA.S. ok thank you for the answer. – Akshada Jul 06 '20 at 13:54

0 Answers0