473,692 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i can't run wxPython

Hello all:
i'am installed wxPython 2.5 and Python2.3.4..i try execute script
with wxPython but it show error:
Traceback (most recent call last):
File "E:\py\test.py" , line 7, in ?
import wx
File "E:\py\wx.p y", line 10, in ?
from wxPython.wx import *
File "D:\Python23\Li b\site-package
import _wx
File "D:\Python23\Li b\site-package
from _core import *
File "D:\Python23\Li b\site-package
import wx._core
ImportError: No module named _core

the test.py file content is :
#----------------------------------------------------------------------
# A very simple wxPython example. Just a wxFrame, wxPanel,
# wxStaticText, wxButton, and a wxBoxSizer, but it shows the basic
# structure of any wxPython application.
#----------------------------------------------------------------------

import wx
class MyFrame(wx.Fram e):
"""
This is MyFrame. It just shows a few controls on a wxPanel,
and has a simple menu.
"""
def __init__(self, parent, title):
wx.Frame.__init __(self, parent, -1, title,
pos=(150, 150), size=(350, 200))

# Create the menubar
menuBar = wx.MenuBar()

# and a menu
menu = wx.Menu()

# add an item to the menu, using \tKeyName automatically
# creates an accelerator, the third param is some help text
# that will show up in the statusbar
menu.Append(wx. ID_EXIT, "E&xit\tAlt-X", "Exit this simple
sample")

# bind the menu event to an event handler
self.Bind(wx.EV T_MENU, self.OnTimeToCl ose, id=wx.ID_EXIT)

# and put the menu on the menubar
menuBar.Append( menu, "&File")
self.SetMenuBar (menuBar)

self.CreateStat usBar()
# Now create the Panel to put the other controls on.
panel = wx.Panel(self)

# and a few controls
text = wx.StaticText(p anel, -1, "Hello World!")
text.SetFont(wx .Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
text.SetSize(te xt.GetBestSize( ))
btn = wx.Button(panel , -1, "Close")
funbtn = wx.Button(panel , -1, "Just for fun...")

# bind the button events to handlers
self.Bind(wx.EV T_BUTTON, self.OnTimeToCl ose, btn)
self.Bind(wx.EV T_BUTTON, self.OnFunButto n, funbtn)

# Use a sizer to layout the controls, stacked vertically and
with
# a 10 pixel border around each
sizer = wx.BoxSizer(wx. VERTICAL)
sizer.Add(text, 0, wx.ALL, 10)
sizer.Add(btn, 0, wx.ALL, 10)
sizer.Add(funbt n, 0, wx.ALL, 10)
panel.SetSizer( sizer)
panel.Layout()
def OnTimeToClose(s elf, evt):
"""Event handler for the button click."""
print "See ya later!"
self.Close()

def OnFunButton(sel f, evt):
"""Event handler for the button click."""
print "Having fun yet?"
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, "Simple wxPython App")
frame.Show(True )
self.SetTopWind ow(frame)
return True

app = MyApp(True)
app.MainLoop()

where is error?? help me.Thank very much!!!
Jul 18 '05 #1
1 2156
I would try downloading a new copy of wx.Python there seems to be a glitch
in your install.

Tom
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2539
by: Anand | last post by:
I am calling a python script from LabVIEW. This is achieved by making a dll call to python22.dll. It works perfectly well for most of my code. I now want to throwup dialog boxes from python. It works just fine if i run the code once. but when i call the same piece of code the second time, wxPython.wx.miscc does not exist for some reason. I dont know how this gets deleted. I guess this happens during some kind of clean up. The code that...
6
2194
by: Logan | last post by:
Would you recommend to use the wx package of wxPython? From the documentation: Provides a way to drop the wx prefix from wxPython objects by dynamically loading and renaming objects from the real wxPython package. This is the first phase of a transition to a new style of using wxPython. For example: import wx
2
1412
by: Axium Computer Services | last post by:
I just recently started trying to teach myself python and wxPython. The python portion of that hasn't been much of a problem as documentation seems available and of good quality. While I was working with wxPython I was beginning to think I was a little dense and missing something very important. Then I started reading the thread about python documentation and in particular the part about wxPython documentation. That made me feel so...
1
2101
by: John Kinson | last post by:
Hi, I'm trying to get the wxPython demo to run on a Debian sarge testing installation, but encounter the following error when I run the demo script: # ./demo.py Traceback (most recent call last): File "./demo.py", line 4, in ? Main.main() File "/root/Python/wxPython-2.5.1.5/demo/Main.py", line 946, in main
1
2564
by: timothy.williams | last post by:
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 machine. I have python in a non-standard place, but I'm using --prefix with the configure script to point to where I have everything. The make install in $WXDIR seemed to go fine. I have the libxw* libraries in my lib/ directory libwx_base-2.5.so@ libwx_gtk_adv-2.5.so.3.0.0* libwx_base-2.5.so.3@ libwx_gtk_core-2.5.so@
6
2399
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.2 release of wxPython is now available for download at http://wxpython.org/download.php. This is a mostly bug fix release and takes care of several "unfortunate features" discovered in the 2.6.3.0 release made last week. A summary of changes is listed below and at http://wxpython.org/recentchanges.php.
0
1308
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.2 release of wxPython is now available for download at http://wxpython.org/download.php. This is a mostly bug fix release and takes care of several "unfortunate features" discovered in the 2.6.3.0 release made last week. A summary of changes is listed below and at http://wxpython.org/recentchanges.php.
4
2981
by: stef | last post by:
hello, I'm trying to move from Delphi to Python (move from MatLab to Python already succeeded, also thanks to this discussion group). From the discussions in this list about "the best" GUI for Python, it now seems to me that wxPython is thé choice for my kind of applications. I've no experience with wxPython yet, I just run a few examples and indeed it looks good (as expected from the
6
1836
by: BartlebyScrivener | last post by:
If there is a wxPython on Debian user in the house? I am using the version of the demo that came with the apt-get download of wxPython. I thought I'd followed the instructions for installing and unpacking the wxPython demo program. It appears to run after a fashion, but I also get this at the commandline. Any help much appreciated. (python:5865): Gtk-CRITICAL **: gtk_window_realize_icon: assertion
17
1537
by: NoelByron | last post by:
Hello! We are thinking about writing a project for several customers in Python. This project would include (among others) wxPython, a C/C++ module. But what happens if this application generates a segmentation fault on a customers PC. What changes do we have to trace back the source of the error? Imagine you use two or three C libraries in a Python project and you experience random crashes in 'Python.exe'. What would you do?
0
8538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9083
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8800
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8801
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5819
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4324
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4557
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2238
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.