472,982 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

ActiveX control in python vs ActiveX control in vb 6 (piece of code)

vml
Hello,

I am trying to mograte from vb 6 to python.

I have a very usefull AX control. It can be :
-just a bitmap
-an active picture where you can plot data and put cursors
-a data explorer

Those 3 behavior are driven by one property in visual studio when you
insert the AX control in a form: the property ModuleName:
-'default' for bitmap
-'Picture' for a picture

I try to insert this AX control in a wxpython based application (I
used one of the example delivered with wx) but when I try to change
the property to get an active picture it does not work and display me
the default bitmap :(
Here is the pice of code
################################################## ##################################

import wx

if wx.Platform == '__WXMSW__':
from wx.lib.activexwrapper import MakeActiveXClass
import win32com.client
try:
ocx = win32com.client.gencache.EnsureModule('{33924602-
C29E-4915-91B1-767CA3D675C2}',0x0,1,0)

except:
raise ImportError("Can't load ocx")

#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.pdf = None

sizer = wx.BoxSizer(wx.VERTICAL)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)

# this function creates a new class that can be used as
# a wxWindow, but contains the given ActiveX control.
coclass=ocx.ActiveXModuleLoader

print coclass

coclass.ModuleName='picture'

ActiveXWrapper = MakeActiveXClass(coclass)

# create an instance of the new class
self.pdf = ActiveXWrapper(self)
#self.pdf.ModuleName='PictureManager'

sizer.Add(self.pdf, 1, wx.EXPAND)

btn = wx.Button(self, wx.NewId(), "Open PDF File")
wx.EVT_BUTTON(self, btn.GetId(), self.OnOpenButton)
btnSizer.Add(btn, 1, wx.EXPAND|wx.ALL, 5)

btn = wx.Button(self, wx.NewId(), "<-- Previous Page")
wx.EVT_BUTTON(self, btn.GetId(), self.OnPrevPageButton)
btnSizer.Add(btn, 1, wx.EXPAND|wx.ALL, 5)

btn = wx.Button(self, wx.NewId(), "Next Page -->")
wx.EVT_BUTTON(self, btn.GetId(), self.OnNextPageButton)
btnSizer.Add(btn, 1, wx.EXPAND|wx.ALL, 5)
btnSizer.Add((50, -1), 2, wx.EXPAND)
sizer.Add(btnSizer, 0, wx.EXPAND)

self.SetSizer(sizer)
self.SetAutoLayout(True)

wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
def OnDestroy(self, evt):
if self.pdf:
self.pdf.Cleanup()
self.pdf = None

def OnOpenButton(self, event):
print 'open'
def OnPrevPageButton(self, event):
print 'button'

def OnNextPageButton(self, event):
print self.pdf.ModuleName

#----------------------------------------------------------------------

def runTest(frame, nb, log):
if wxPlatform == '__WXMSW__':
win = TestPanel(nb, log)
return win
else:
dlg = wx.MessageDialog(frame, 'This demo only works on MSW.',
'Sorry', wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
overview = __doc__

#----------------------------------------------------------------------
if __name__ == '__main__':
import sys
class TestFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "ActiveX test",
size=(640, 480),
style=wx.DEFAULT_FRAME_STYLE|
wx.NO_FULL_REPAINT_ON_RESIZE)
self.tp = TestPanel(self, sys.stdout)
app = wx.PySimpleApp()
frame = TestFrame()
frame.Show(True)
app.MainLoop()

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

I suspect that the activex control is bugged .... but how to know that
since it is working perfectly under visual studio vb 6 but not with
python ?:(

please help me !

Aug 22 '07 #1
0 2055

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

Similar topics

1
by: Vin | last post by:
Is it possible to access a function defined in python shell from c-code? For example if I have defined >>> def c(x): .... return x*x .... and defined in some module foo
4
by: angel | last post by:
Hi I want to write an ActiveX by using python. And I know how do, but I don't know how python to access DHTML Document.If using cpp, it can be done by following source. /****/...
3
by: Maurice LING | last post by:
I know this might sounds wierd but I'm wondering if I can use pexpect or os.popen3 function to invoke and control python interpreter to make it act like a python interpreter in python? maurice
2
by: adiel | last post by:
Hello, I am trying to access the properties and methods from a user control within the code-behind file for a webform but I am receiving the message: Name 'MenuBar1' is not declared It does...
0
by: Vincent Mouton | last post by:
Hi, I am having trouble integrating a System.Windows.Forms.Control into an asp.net page. I based my tryout on the sample provided in the quickstart tutorials...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
0
by: tulsaparihar | last post by:
plz tell me the steps to create ActiveX dll and ActiveX exe and can i use these to my project
1
by: Salim | last post by:
Hi, I'm trying to get UniqueID of a linkbutton. I have 2 web user controls. And a master page. In fisrst web user control there is a datalist. In datalist ItemCreated event, I try to find...
3
by: JJ | last post by:
Whats the best way to convert a user control to a custom server control? i.e. I created a .aspx control using the designer to create the look of the control. I now want to use this in other...
2
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a web app that when I click a menu, I load a control. On one of these controls, I have a button that when clicked, I need to unload the control to unload itself and load a different control...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.