473,735 Members | 5,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to make python socket server work with the app.MainLoop() in wxpython?

Hi everyone,
I am using a python socket server to collect data from a socket
client and then control a image location ( wxpython) with the data,
i.e. moving the image around in the wxpython frame.
But the "app.MainLoop() " in wxpython looks like conflicting with
the "while 1:" in socket server. After I commented the
"app.MainLoop() ", everything is working except two things:
1. if I click anywhere on the screen with the mouse, the image is
gong and only the empty frame( or panel) is left.
2. if I don't touch anything, the image is being moved around but
the previous images are left behind in the panel.
I guess that may be caused by "app.MainLoop() " commented.
Anybody knows how to make the two things work together? I really
appreciate your help.
My sample code is modified based on the wxpython demo: image.py.
socket client is also attached for your reference.

Ouyang

############### # socket server with wxpython ##############

from Main import opj
import wx,string
class MMCS(wx.Frame):
def __init__(self):
self.bmp = wx.Image(opj('b itmaps/image.bmp'),
wx.BITMAP_TYPE_ BMP)
self.bmp.SetMas k(True)
wx.Frame.__init __(self, parent=None, title='monitori ng system',
size=(500,600))
self.panel = wx.Panel(self,-1)

def monitor(self,x, y,angle):
bmp = self.bmp.Rotate (angle, (x,y), True,None)
bmp = bmp.ConvertToBi tmap()

wx.StaticBitmap (self.panel, -1, bmp, (x, y), (bmp.GetWidth() ,
bmp.GetHeight() ))
del bmp

app = wx.PySimpleApp( )
frame = MMCS()
frame.Show()
frame.monitor(5 0,10,0.0)
#app.MainLoop()

# Server program
from socket import *
# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket and bind to address
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(ad dr)

# Receive messages
while 1:
data,addr = UDPSock.recvfro m(buf)
if not data:
print "Client has exited!"
break
else:
print "\nReceived message '", data,"'"
d = string.split(da ta, '-')

frame.monitor(s tring.atoi(d[0]),string.atoi(d[1]),string.atof(d[2]))
if data == 'END':
print "end of moving the ship"

# Close socket
UDPSock.close()

############# socket client ############### #######>
rom socket import *
import time

# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket
UDPSock = socket(AF_INET, SOCK_DGRAM)
def_msg = "===Enter message to send to server===";
print "\n",def_ms g

# Send messages
while (1):
for i in range(100):
time.sleep(1)
data = "50-100-%s"%(0.1*i)
if(UDPSock.send to(data,addr)):
print "Sending message '",data,"'..... "
# Close socket
UDPSock.close()

Jul 30 '06 #1
9 5555
zxo102 wrote:
Hi everyone,
I am using a python socket server to collect data from a socket
client and then control a image location ( wxpython) with the data,
i.e. moving the image around in the wxpython frame.
But the "app.MainLoop() " in wxpython looks like conflicting with
the "while 1:" in socket server. After I commented the
"app.MainLoop() ", everything is working except two things:
1. if I click anywhere on the screen with the mouse, the image is
gong and only the empty frame( or panel) is left.
2. if I don't touch anything, the image is being moved around but
the previous images are left behind in the panel.
I guess that may be caused by "app.MainLoop() " commented.
Anybody knows how to make the two things work together? I really
appreciate your help.
My sample code is modified based on the wxpython demo: image.py.
socket client is also attached for your reference.

Ouyang

############### # socket server with wxpython ##############

from Main import opj
import wx,string
class MMCS(wx.Frame):
def __init__(self):
self.bmp = wx.Image(opj('b itmaps/image.bmp'),
wx.BITMAP_TYPE_ BMP)
self.bmp.SetMas k(True)
wx.Frame.__init __(self, parent=None, title='monitori ng system',
size=(500,600))
self.panel = wx.Panel(self,-1)

def monitor(self,x, y,angle):
bmp = self.bmp.Rotate (angle, (x,y), True,None)
bmp = bmp.ConvertToBi tmap()

wx.StaticBitmap (self.panel, -1, bmp, (x, y), (bmp.GetWidth() ,
bmp.GetHeight() ))
del bmp

app = wx.PySimpleApp( )
frame = MMCS()
frame.Show()
frame.monitor(5 0,10,0.0)
#app.MainLoop()

# Server program
from socket import *
# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket and bind to address
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(ad dr)

# Receive messages
while 1:
data,addr = UDPSock.recvfro m(buf)
if not data:
print "Client has exited!"
break
else:
print "\nReceived message '", data,"'"
d = string.split(da ta, '-')

frame.monitor(s tring.atoi(d[0]),string.atoi(d[1]),string.atof(d[2]))
if data == 'END':
print "end of moving the ship"

# Close socket
UDPSock.close()

############# socket client ############### #######>
rom socket import *
import time

# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket
UDPSock = socket(AF_INET, SOCK_DGRAM)
def_msg = "===Enter message to send to server===";
print "\n",def_ms g

# Send messages
while (1):
for i in range(100):
time.sleep(1)
data = "50-100-%s"%(0.1*i)
if(UDPSock.send to(data,addr)):
print "Sending message '",data,"'..... "
# Close socket
UDPSock.close()

If you get rid of app.MaiLoop(), you basically get rid of all GUI events.
You need to have you server in a separate thread.

Philippe
Jul 30 '06 #2
Philippe Martin wrote:
zxo102 wrote:
>Hi everyone,
I am using a python socket server to collect data from a socket
client and then control a image location ( wxpython) with the data,
i.e. moving the image around in the wxpython frame.
But the "app.MainLoop() " in wxpython looks like conflicting with
the "while 1:" in socket server. After I commented the
"app.MainLoop( )", everything is working except two things:
1. if I click anywhere on the screen with the mouse, the image is
gong and only the empty frame( or panel) is left.
2. if I don't touch anything, the image is being moved around but
the previous images are left behind in the panel.
I guess that may be caused by "app.MainLoop() " commented.
Anybody knows how to make the two things work together? I really
appreciate your help.
My sample code is modified based on the wxpython demo: image.py.
socket client is also attached for your reference.

Ouyang

############## ## socket server with wxpython ##############

from Main import opj
import wx,string
class MMCS(wx.Frame):
def __init__(self):
self.bmp = wx.Image(opj('b itmaps/image.bmp'),
wx.BITMAP_TYPE _BMP)
self.bmp.SetMas k(True)
wx.Frame.__init __(self, parent=None, title='monitori ng system',
size=(500,600) )
self.panel = wx.Panel(self,-1)

def monitor(self,x, y,angle):
bmp = self.bmp.Rotate (angle, (x,y), True,None)
bmp = bmp.ConvertToBi tmap()

wx.StaticBitmap (self.panel, -1, bmp, (x, y), (bmp.GetWidth() ,
bmp.GetHeight( )))
del bmp

app = wx.PySimpleApp( )
frame = MMCS()
frame.Show()
frame.monitor( 50,10,0.0)
#app.MainLoop( )

# Server program
from socket import *
# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket and bind to address
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(a ddr)

# Receive messages
while 1:
data,addr = UDPSock.recvfro m(buf)
if not data:
print "Client has exited!"
break
else:
print "\nReceived message '", data,"'"
d = string.split(da ta, '-')

frame.monitor( string.atoi(d[0]),string.atoi(d[1]),string.atof(d[2]))
if data == 'END':
print "end of moving the ship"

# Close socket
UDPSock.close( )

############ # socket client ############### #######>
rom socket import *
import time

# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket
UDPSock = socket(AF_INET, SOCK_DGRAM)
def_msg = "===Enter message to send to server===";
print "\n",def_ms g

# Send messages
while (1):
for i in range(100):
time.sleep(1)
data = "50-100-%s"%(0.1*i)
if(UDPSock.sen dto(data,addr)) :
print "Sending message '",data,"'..... "
# Close socket
UDPSock.close( )


If you get rid of app.MaiLoop(), you basically get rid of all GUI events.
You need to have you server in a separate thread.

Philippe
PS:

http://wiki.wxpython.org/index.cgi/LongRunningTasks

Jul 30 '06 #3
On 2006-07-30, Philippe Martin <pm*****@snakec ard.comwrote:
If you get rid of app.MaiLoop(), you basically get rid of all GUI events.
You need to have you server in a separate thread.
Isn't there any way to use wxWidgets socket callbacks in wxPython?

--
Grant Edwards grante Yow! I'm wearing PAMPERS!!
at
visi.com
Jul 30 '06 #4
Philippe,

Thanks a lot. I got the idea. Let me try it.

Ouyang

Philippe Martin 写道:
Philippe Martin wrote:
zxo102 wrote:
Hi everyone,
I am using a python socket server to collect data from a socket
client and then control a image location ( wxpython) with the data,
i.e. moving the image around in the wxpython frame.
But the "app.MainLoop() " in wxpython looks like conflicting with
the "while 1:" in socket server. After I commented the
"app.MainLoop() ", everything is working except two things:
1. if I click anywhere on the screen with the mouse, the image is
gong and only the empty frame( or panel) is left.
2. if I don't touch anything, the image is being moved around but
the previous images are left behind in the panel.
I guess that may be caused by "app.MainLoop() " commented.
Anybody knows how to make the two things work together? I really
appreciate your help.
My sample code is modified based on the wxpython demo: image.py.
socket client is also attached for your reference.

Ouyang

############### # socket server with wxpython ##############

from Main import opj
import wx,string
class MMCS(wx.Frame):
def __init__(self):
self.bmp = wx.Image(opj('b itmaps/image.bmp'),
wx.BITMAP_TYPE_ BMP)
self.bmp.SetMas k(True)
wx.Frame.__init __(self, parent=None, title='monitori ng system',
size=(500,600))
self.panel = wx.Panel(self,-1)

def monitor(self,x, y,angle):
bmp = self.bmp.Rotate (angle, (x,y), True,None)
bmp = bmp.ConvertToBi tmap()

wx.StaticBitmap (self.panel, -1, bmp, (x, y), (bmp.GetWidth() ,
bmp.GetHeight() ))
del bmp

app = wx.PySimpleApp( )
frame = MMCS()
frame.Show()
frame.monitor(5 0,10,0.0)
#app.MainLoop()

# Server program
from socket import *
# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket and bind to address
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(ad dr)

# Receive messages
while 1:
data,addr = UDPSock.recvfro m(buf)
if not data:
print "Client has exited!"
break
else:
print "\nReceived message '", data,"'"
d = string.split(da ta, '-')

frame.monitor(s tring.atoi(d[0]),string.atoi(d[1]),string.atof(d[2]))
if data == 'END':
print "end of moving the ship"

# Close socket
UDPSock.close()

############# socket client ############### #######>
rom socket import *
import time

# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket
UDPSock = socket(AF_INET, SOCK_DGRAM)
def_msg = "===Enter message to send to server===";
print "\n",def_ms g

# Send messages
while (1):
for i in range(100):
time.sleep(1)
data = "50-100-%s"%(0.1*i)
if(UDPSock.send to(data,addr)):
print "Sending message '",data,"'..... "
# Close socket
UDPSock.close()

If you get rid of app.MaiLoop(), you basically get rid of all GUI events.
You need to have you server in a separate thread.

Philippe
PS:

http://wiki.wxpython.org/index.cgi/LongRunningTasks
Jul 30 '06 #5

Philippe Martin wrote:
Philippe Martin wrote:
You need to have you server in a separate thread.
PS:

http://wiki.wxpython.org/index.cgi/LongRunningTasks

And here's an important bit from the wxWindows doc:

For communication between secondary threads and the main thread,
you may use wxEvtHandler::A ddPendingEvent or its short version
wxPostEvent. These functions have thread safe implementation
[...]
<http://www.wxwindows.o rg/manuals/2.6.3/wx_wxthreadover view.html>

Calling various wxWindows functions from threads other than the
one that runs the GUI, can cause a crash. Use only those that the
authoritative documentation states to be thread-safe, such as
wxPostEvent. The Wiki page that Pilippe cited says that
wxCallAfter uses wxPostEvent internally, so it should also be
thread-safe. I still wouldn't use it; internals are subject to
change.
--
--Bryan

Jul 30 '06 #6
Grant Edwards wrote:
On 2006-07-30, Philippe Martin <pm*****@snakec ard.comwrote:
>If you get rid of app.MaiLoop(), you basically get rid of all GUI events.
You need to have you server in a separate thread.

Isn't there any way to use wxWidgets socket callbacks in wxPython?

--
Grant Edwards grante Yow! I'm wearing
PAMPERS!!
at
visi.com
If I understand correctly, I guess you can send an event to the main thread
to tell it there was data received.

Regards,

Philippe

Jul 30 '06 #7
I think you should use thread.
I just write a similar program using thread. It works well
You can try it, good luck!

Jul 31 '06 #8
Philippe,

I just wrote the code following the example you provided. The image
location can be controlled with the data from socket client. But only
one thing confuse me. When the image keeps moving to a new location,
the image at a "old" location is not deleted and is left behind in the
frame. Do you know what is going on with it? The location of image is
processed in "def OnResult(self,e vent):" and is initialized in "def
__init__(self, parent, id):" of "class MainFrame" ( See the code
attached).

Thanks a lot.

ouyang

############### ############### ############### #####
import time
from threading import *
import wx, string

from socket import *
from Main import opj

host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(ad dr)

# Button definitions
ID_START = wx.NewId()
ID_STOP = wx.NewId()

# Define notification event for thread completion
EVT_RESULT_ID = wx.NewId()

def EVT_RESULT(win, func):
"""Define Result Event."""
win.Connect(-1, -1, EVT_RESULT_ID, func)

class ResultEvent(wx. PyEvent):
"""Simple event to carry arbitrary result data."""
def __init__(self, data):
"""Init Result Event."""
wx.PyEvent.__in it__(self)
self.SetEventTy pe(EVT_RESULT_I D)
d = string.split(da ta,'-')
self.data =
[string.atoi(d[0]),string.atoi(d[1]),string.atof(d[2])]

# Thread class that executes processing
class WorkerThread(Th read):
"""Worker Thread Class."""
def __init__(self, notify_window):
"""Init Worker Thread Class."""
Thread.__init__ (self)
self._notify_wi ndow = notify_window
self._want_abor t = 0
# This starts the thread running on creation, but you could
# also make the GUI thread responsible for calling this
self.start()

def run(self):
"""Run Worker Thread."""
# This is the code executing in the new thread. Simulation of
# a long process (well, 10s here) as a simple loop - you will
# need to structure your processing so that you periodically
# peek at the abort variable
while 1:
if self._want_abor t:
wx.PostEvent(se lf._notify_wind ow, ResultEvent(Non e))
#return
break
else:
data,addr = UDPSock.recvfro m(buf)
if not data:
print "Client has exited!"
break
else:
print "\nReceived message '", data,"'"
wx.PostEvent(se lf._notify_wind ow, ResultEvent(dat a))

# Close socket
UDPSock.close()
def abort(self):
"""abort worker thread."""
# Method for use by main thread to signal an abort
self._want_abor t = 1

# GUI Frame class that spins off the worker thread
class MainFrame(wx.Fr ame):
"""Class MainFrame."""
def __init__(self, parent, id):
"""Create the MainFrame."""
wx.Frame.__init __(self, parent,id, title='monitori ng system',
size=(500,600))
self.panel = wx.Panel(self,-1,(0,0),(500,60 0))

self.bmp = wx.Image(opj('b itmaps/image.bmp'), wx.BITMAP_TYPE_ BMP)
self.bmp.SetMas k(True)

# Dumb sample frame with two buttons
wx.Button(self. panel, ID_START, 'Start', pos=(0,0))
wx.Button(self. panel, ID_STOP, 'Stop', pos=(0,50))
self.status = wx.StaticText(s elf.panel, -1, '', pos=(0,100))

x = 50
y = 150
angle = 1.23
bmp = self.bmp.Rotate (angle, (x,y), True,None)
bmp = bmp.ConvertToBi tmap()
wx.StaticBitmap (self.panel, -1, bmp, (x, y), (bmp.GetWidth() ,
bmp.GetHeight() ))

self.Bind(wx.EV T_BUTTON, self.OnStart, id=ID_START)
self.Bind(wx.EV T_BUTTON, self.OnStop, id=ID_STOP)

# Set up event handler for any worker thread results
EVT_RESULT(self ,self.OnResult)

# And indicate we don't have a worker thread yet
self.worker = None

def OnStart(self, event):
"""Start Computation."""
# Trigger the worker thread unless it's already busy
if not self.worker:
self.status.Set Label('Starting computation')
self.worker = WorkerThread(se lf)

def OnStop(self, event):
"""Stop Computation."""
# Flag the worker thread to stop if running
if self.worker:
self.status.Set Label('Trying to abort computation')
self.worker.abo rt()

def OnResult(self, event):
"""Show Result status."""
if event.data is None:
# Thread aborted (using our convention of None return)
self.status.Set Label('Computat ion aborted')
else:
# Process results here
self.status.Set Label('Computat ion Result: %s-%s-%s' %
(event.data[0], event.data[1],event.data[2]))
angle = event.data[2]
x = event.data[0]
y = event.data[1]
bmp = self.bmp.Rotate (angle, (x,y), True,None)
bmp = bmp.ConvertToBi tmap()
wx.StaticBitmap (self.panel, -1, bmp, (x, y),
(bmp.GetWidth() , bmp.GetHeight() ))
# In either event, the worker is done
self.worker = None

class MainApp(wx.App) :
"""Class Main App."""
def OnInit(self):
"""Init Main App."""
self.frame = MainFrame(None, -1)
self.frame.Show (True)
self.SetTopWind ow(self.frame)
return True

if __name__ == '__main__':
app = MainApp(0)
app.MainLoop()

############### ############### ############### #############

Philippe Martin 写道:
Philippe Martin wrote:
zxo102 wrote:
Hi everyone,
I am using a python socket server to collect data from a socket
client and then control a image location ( wxpython) with the data,
i.e. moving the image around in the wxpython frame.
But the "app.MainLoop() " in wxpython looks like conflicting with
the "while 1:" in socket server. After I commented the
"app.MainLoop() ", everything is working except two things:
1. if I click anywhere on the screen with the mouse, the image is
gong and only the empty frame( or panel) is left.
2. if I don't touch anything, the image is being moved around but
the previous images are left behind in the panel.
I guess that may be caused by "app.MainLoop() " commented.
Anybody knows how to make the two things work together? I really
appreciate your help.
My sample code is modified based on the wxpython demo: image.py.
socket client is also attached for your reference.

Ouyang

############### # socket server with wxpython ##############

from Main import opj
import wx,string
class MMCS(wx.Frame):
def __init__(self):
self.bmp = wx.Image(opj('b itmaps/image.bmp'),
wx.BITMAP_TYPE_ BMP)
self.bmp.SetMas k(True)
wx.Frame.__init __(self, parent=None, title='monitori ng system',
size=(500,600))
self.panel = wx.Panel(self,-1)

def monitor(self,x, y,angle):
bmp = self.bmp.Rotate (angle, (x,y), True,None)
bmp = bmp.ConvertToBi tmap()

wx.StaticBitmap (self.panel, -1, bmp, (x, y), (bmp.GetWidth() ,
bmp.GetHeight() ))
del bmp

app = wx.PySimpleApp( )
frame = MMCS()
frame.Show()
frame.monitor(5 0,10,0.0)
#app.MainLoop()

# Server program
from socket import *
# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket and bind to address
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(ad dr)

# Receive messages
while 1:
data,addr = UDPSock.recvfro m(buf)
if not data:
print "Client has exited!"
break
else:
print "\nReceived message '", data,"'"
d = string.split(da ta, '-')

frame.monitor(s tring.atoi(d[0]),string.atoi(d[1]),string.atof(d[2]))
if data == 'END':
print "end of moving the ship"

# Close socket
UDPSock.close()

############# socket client ############### #######>
rom socket import *
import time

# Set the socket parameters
host = "192.168.0. 2"
port = 21567
buf = 1024
addr = (host,port)

# Create socket
UDPSock = socket(AF_INET, SOCK_DGRAM)
def_msg = "===Enter message to send to server===";
print "\n",def_ms g

# Send messages
while (1):
for i in range(100):
time.sleep(1)
data = "50-100-%s"%(0.1*i)
if(UDPSock.send to(data,addr)):
print "Sending message '",data,"'..... "
# Close socket
UDPSock.close()

If you get rid of app.MaiLoop(), you basically get rid of all GUI events.
You need to have you server in a separate thread.

Philippe
PS:

http://wiki.wxpython.org/index.cgi/LongRunningTasks
Aug 1 '06 #9
Dennis:

Thanks for your message. Let me try the double-buffer-operation.

Ouyang
Dennis Lee Bieber wrote:
On 1 Aug 2006 01:10:18 -0700, "zxo102" <zx****@gmail.c omdeclaimed the
following in comp.lang.pytho n:

I just wrote the code following the example you provided. The image
location can be controlled with the data from socket client. But only
one thing confuse me. When the image keeps moving to a new location,
the image at a "old" location is not deleted and is left behind in the
frame. Do you know what is going on with it? The location of image is
processed in "def OnResult(self,e vent):" and is initialized in "def
__init__(self, parent, id):" of "class MainFrame" ( See the code
attached).
Off hand, it is doing just what the code says it should.

Each time you update position, you are COPYING a SMALL rectangle
(the "moved" image) into the larger frame... Only the pixels
corresponding to the small rectangle are changed -- anything that was
already in the frame stays there.

You might want to double-buffer the operations...

For each move:
clear an unseen "frame-sized" buffer
compute the new location of the "moved" image
blit the "moved" image into the unseen buffer
blit the full unseen buffer to the viewed frame (not to a
portion of the frame, but replace the entire frame contents)

The double-buffer is to avoid annoying the viewer with the "flash"
of clearing out the view frame before drawing the new image

--
Wulfraed Dennis Lee Bieber KD6MOG
wl*****@ix.netc om.com wu******@bestia ria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: we******@bestia ria.com)
HTTP://www.bestiaria.com/
Aug 8 '06 #10

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

Similar topics

0
1559
by: Ajay | last post by:
hi! i have a main application which is run through a GUI. the GUI has a function 'start server' which starts a server in another thread and a stop function which should stop this server. the code is from Tkinter import * import tkMessageBox import tkFileDialog
3
2049
by: Maboroshi | last post by:
Hi I am building a simple chat program but I am running into problems interacting with more than one client I can send a message to a server and it can recieve it no problem but how do I get more than one client to see the messages as well so clients can talk to eachother basically how do I get the server to send the messages back so all the clients can see it Here is my code The Server...
23
2491
by: Antoon Pardon | last post by:
I have had a look at the signal module and the example and came to the conclusion that the example wont work if you try to do this in a thread. So is there a chance similar code will work in a thread? -- Antoon Pardon
10
3689
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
9
4975
by: monkey | last post by:
I just learn to make a blank windows frame with python and wxpython. I found the statment "import wx" cannot work as the original "from wxPython.wx import *". I see in the readme file of wxpython that if I install it as the default one, I can use "import wx" instead of the long one. What is wrong? The code pasted below: import wx # the default is "from wxPython.wx import *", I change it and it just can't work. class MyApp(wxApp):
29
2781
by: Frank Millman | last post by:
Hi all I am writing a multi-user accounting/business system. Data is stored in a database (PostgreSQL on Linux, SQL Server on Windows). I have written a Python program to run on the client, which uses wxPython as a gui, and connects to the database via TCP/IP. The client program contains all the authentication and business logic. It has dawned on me that anyone can bypass this by modifying the program. As it is written in Python, with...
52
3617
by: Steve Holden | last post by:
I've been thinking (and blogging) about python evangelism since PyCon, as a result of which I created a squidoo lens: http://www.squidoo.com/pythonlogy Imagine my surprise at discovering that this has gone up in rank (by number of views) from # 442,000 or so to #153! Clearly there's some mileage in marketing Python, and I'd like to keep the buzz going if it means more people will adopt the language.
1
2328
by: Jim Langston | last post by:
Windows. Situation: Using a Python program called OpenRPG. I have a program that displays form data (a character sheet) in C++. I am able in the C++ program to build a string and copy it into the clipboard, then paste it into the input in the running Python program. I would like to somehow automate this, that is, have the python instance communicate with the C++ instance and vice versa. I'm still trying to think of a way to do this. ...
3
2733
by: lee.walczak | last post by:
Hi, I have just started writing a GUI using wxpython after finding a limitation using Tkinter. I have read most tutorials on wxpython and slowly becoming accustomed considering I started with the latter GUI tool first! I must quote first that I am a novice user of python so the issue(s) I have may seem very obvious but please be patient with me! I have noticed that all the wxpython references I used for creating my
0
8957
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8783
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
9459
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
9248
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
8194
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 projectplanning, coding, testing, and deploymentwithout 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...
1
6745
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4819
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3268
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2736
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.