import wx app = wx.App() win = wx.Frame(None) win.Show() app.MainLoop()
Why does the above code only work in python2.7 and not 3?
What do you mean do not work? What is the error message, what versions of wx you have installed in Python 2.7 and what in Python 3. Are you sure you switch between the versions properly (wxversion.select)?
Edited 4 Years Ago by pyTony
wxPython has not been ported to Python3 yet.
However, PySide/PyQT is available for all versions of Python.
Tkinter and its extensions tix and ttk are included in Python27 and all higher versions.
Edited 4 Years Ago by Lardmeister
As postet Lardmeister there are no official wxpython version for python 3 yet.
The porting to python 3 is under way with Project Phoenix
There are working version to test here.
I have tested code over and it work in python 3.2.
Edited 4 Years Ago by snippsat
Thanks snippsat, I tested it out on my Windows machine:
'''wxp_combobox1.py test the wx.ComboBox() widget wx.ComboBox(parent, id, value, pos, size, choices, style) a combination of a wx.TextCtrl() and a drop down listbox tested with Python32 and wx(Phoenix) downloaded wxPython-Phoenix-r72945-win32-py3.2.tar.gz from http://wxpython.org/Phoenix/snapshot-builds/ then simply extracted the wx folder to C:\Python32\Lib\site-packages ''' import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, size=mysize) self.SetBackgroundColour("yellow") choice_list = [str(year) for year in range(2000, 2015)] # create an input widget self.combo = wx.ComboBox( self, 200, choices=choice_list, pos=(10, 40), size=(150, 100)) self.combo.SetValue('Select a year') # bind mouse click in the dropdown list to an action self.combo.Bind(wx.EVT_COMBOBOX, self.onAction) # the Enter key has been pressed in the entry field # this allows you to write/edit your own selection self.combo.Bind(wx.EVT_TEXT_ENTER, self.onAction) # create an output widget s = "Click on the right side drop down marker" self.label = wx.StaticText(self, wx.ID_ANY, s, pos=(10, 10)) def onAction(self, event): """ some action code""" s = "You selected the year " + self.combo.GetValue() self.label.SetLabel(s) app = wx.App(0) # create a MyFrame instance and show the frame MyFrame(None, 'testing wx.ComboBox()', (300, 200)).Show() app.MainLoop()
As of 11/12/2012 not all the wx modules have been ported yet, for instance imageutils in wx.lib.buttons.
Edited 4 Years Ago by Lardmeister: date
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:
Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click Dim txtB1 As New TextBox Dim i For i = ...