wxPython 需要某种树表示

发布于 2024-11-05 19:09:16 字数 318 浏览 5 评论 0原文

我的项目已经到了一个阶段,我不知道如何继续下去。我当前的任务是让用户能够为某些自定义项目创建文件夹结构。所以基本上用户应该能够添加一个新文件夹,向该文件夹添加一些数据,当然还可以可视化他的项目文件夹/数据结构。
所以基本上我需要类似于 jsTree 的东西。

现在我的问题是:wx 中是否已经定义了任何类型的小部件来提供与此类似的功能?如果(我猜很有可能)这样的东西还不存在,你建议采取什么方法?到目前为止,我唯一的想法是尝试使用带有大量调整的 flexgridsizer 或某种递归方法来创建它,该方法不断添加充满自定义按钮的 sizer 直到文件夹树结束,但我希望有一些更好的方法对于这个问题。

I have reached a point in my project from which I'm not sure how to continue. My current task is to give the user a possibility to create a folder structure for some custom projects. So basically the user should be able to add a new folder , add some data to the folder and of course visualize his project folder/data structure.
So basically I would need something similar to a jsTree.

Now my question is: is there any kind of widget already defined in wx that offers something similar to this? If (and I'm guessing there's a high probability ) something like this doesn't already exist, what do you recommend as an approach? My only idea so far would be to try to create this somehow using either a flexgridsizer with a lot of tweaking or some kind of recursive method that keeps adding sizers full of custom buttons until the folder tree ends , but I hope there are some better approaches to this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不爱素颜 2024-11-12 19:09:16

您可以使用一些小部件:

wx.TreeCtrl 其中可能会做你想做的一切。

功能不同(合并 MVC)的替代小部件是 wx.lib.mvctree.MVCTree

您还可以自定义更多内容(最扩展 wx.TreeCtrl)。为什么不看看 wxPython 演示,它将向您展示所有不同的内容控制工作。它已经显示了 MVCTree 控件如何处理文件。

There are a few widgets you could use:

wx.TreeCtrl which would probably do everything you are looking to do.

An alternative widget that functions differently (Incorporates MVC) would be the wx.lib.mvctree.MVCTree

There are even more again that you could customise (Most extending wx.TreeCtrl). Why don't you have a look at the wxPython demo which will show you all the different controls works. It already shows the MVCTree control working with files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文