Re: [Tutor] Explorer bar window(wxpython) combined to Tkinter

2017-02-08 Thread Alan Gauld via Tutor
On 08/02/17 23:09, Pooja Bhalode wrote:

> But, I want to create this in the original GUI window that I am working in
> using Tkinter. However, when I tried importing it, I am not able to
> understand how to deal with different roots,

Unfortunately you cannot mix toolkits. You either use
Tkinter or wxPython. Similarly PyQt, PyGTK, Kivy etc
all need to be used on their own.

There are a few exceptions where one toolkit is built
on another so you might be able to mix the underlying
toolkit into the higher level one, but they are rare
cases and still often don't work due to event loop clashes.

So you must either write your entire app in wxPython
or in Tkinter.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Explorer bar window(wxpython) combined to Tkinter

2017-02-08 Thread Pooja Bhalode
Hi,

I have been working on creating an explorer bar in GUI. I found the code
the explorer bar online using wx python. This creates a window shown below.
[image: Inline image 1]

But, I want to create this in the original GUI window that I am working in
using Tkinter. However, when I tried importing it, I am not able to
understand how to deal with different roots,

wxpython:
root = wx.App(False)

Tkinter
root = Tk()

The code for the wxpython is given below:
import os
import wx

class MainWindow(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)

self.panel = wx.Panel(self)
self.dir = wx.GenericDirCtrl(self.panel, size=(200, -1),
style=wx.DIRCTRL_DIR_ONLY)
self.files = wx.ListCtrl(self.panel, style=wx.LC_LIST)

self.sizer = wx.BoxSizer()
self.sizer.Add(self.dir, flag=wx.EXPAND)
self.sizer.Add(self.files, proportion=1, flag=wx.EXPAND)

self.border = wx.BoxSizer()
self.border.Add(self.sizer, 1, wx.ALL | wx.EXPAND, 5)

self.panel.SetSizerAndFit(self.border)
self.Show()

self.dir.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelect)


def OnSelect(self, e):
self.files.ClearAll()
list = os.listdir(self.dir.GetPath())
for a in reversed(list):
self.files.InsertStringItem(0, a)

root = wx.App(False)

win = MainWindow(None, size=(600, 400))
root.MainLoop()

whereas the code for the GUI that I am working on using Tkinter is given
below:

from Tkinter import *
import datetime
import tkMessageBox
from tkFileDialog import *
from tkMessageBox import *

root = Tk()
root.title("Design of Experiments with Parameter Estimation")
root.geometry("1000x1000")

menu = Menu(root)

root.config(menu=menu)

submenu = Menu(menu)
menu.add_cascade(label="File", menu=submenu)

submenu.add_command(label="New", command=NewWindow)
submenu.add_command(label="Open", command=OpenFile)
submenu.add_command(label="Load", command=LoadNew)
submenu.add_separator()
submenu.add_command(label="Save", command=save)
submenu.add_command(label="Save As", command=Doit)

root.mainloop()

The GUI shows as below:

[image: Inline image 2]


Can someone please tell me how to combine these two so that the
Explorer bar shows up in the space shown in the figure.

Thank you so much in advance.

Yours truly,

Pooja
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor