wxpython SpinCtrl/SpinButton是否在Classic和Phoenix之间进行了更改? [英] Has wxpython SpinCtrl/SpinButton changed between Classic and Phoenix?

查看:100
本文介绍了wxpython SpinCtrl/SpinButton是否在Classic和Phoenix之间进行了更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始考虑将我的项目之一从python2.7/wxpython 3.0.2.0转换为python3.5.2/wxpython 4.0.0b2,并立即遇到SpinCtrl/SpinButton的问题.
我在Linux Mint 18.2上运行

I have started to look at converting one of my projects from python2.7/wxpython 3.0.2.0 to python3.5.2/wxpython 4.0.0b2 and have immediately hit an issue with SpinCtrl/SpinButton.
I'm running on Linux Mint 18.2

使用此代码:

import wx

class MainWindow(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        self.panel = wx.Panel(self)
        self.SetSize((200,200))
        sizer=wx.BoxSizer(wx.VERTICAL)
        text1 = wx.StaticText(self.panel,-1,"SpinCtrl")
        self.spin = wx.SpinCtrl(self.panel,-1, size=(100,25),style=wx.SP_VERTICAL)
        text2 = wx.StaticText(self.panel,-1,"SpinButton")
        self.spin2 = wx.SpinButton(self.panel,-1, size=(100,25),style=wx.SP_VERTICAL)
        sizer.Add(text1)
        sizer.Add(self.spin, 0, wx.LEFT, 15)
        sizer.Add((-1, -1), proportion=1)
        sizer.Add(text2)
        sizer.Add(self.spin2, 0, wx.LEFT, 15)
        self.SetSizer(sizer)
        self.Show()

app = wx.App()
win = MainWindow(None)
app.MainLoop()

在python2.7/wxpython 3.0.2.0中运行时,得到以下结果:

When running with python2.7/wxpython 3.0.2.0, I get this result:

在python3.5.2/wxpython 4.0.0b2上运行相同代码的同时,我得到了以下信息:

Whilst running the same code with python3.5.2/wxpython 4.0.0b2, I get this:

我非常想找回旧的"垂直旋转控件,因为与+/-控件的新"版本相比,它们的大小可以占用更少的空间.
有谁知道如何在wxpython 4.0.0b2中恢复垂直旋转控件?

I am desperate to get the "old" vertical spin controls back, as they can be sized to take up significantly less space than this "new" version with the +/- controls.
Does anyone know how to get the vertical spin controls back in wxpython 4.0.0b2?

推荐答案

正如罗宾指出的,一个安装正在使用gtk2,而另一个安装是使用gtk3.
使用以下安装说明已解决该问题.

As Robin pointed out, one install was using gtk2 and the other gtk3.
The issue was resolved using the following installation instruction.

sudo pip3 install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-16.04 wxPython

这篇关于wxpython SpinCtrl/SpinButton是否在Classic和Phoenix之间进行了更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆