I've been experimenting with passing a window handle from a wxPython app to
a Tkinter app. The Tkinter app should embed a Toplevel window containing a
Canvas widget in the wxPython app's Frame (see example below).
Both apps run, but the Tkinter app's output doesn't appear.
Can anyone see why this isn't working?
Using wxPython-2.5.1/Python 2.3.3/Win98 and Win2000.
regards
Richard
----------------------------
#!/usr/bin/env python
# generated by wxGlade 0.3.3 on Thu Jun 03 14:36:32 2004
import wx
import os
class MyFrame(wx.Fram e):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init_ _
kwds["style"] = wx.DEFAULT_FRAM E_STYLE
wx.Frame.__init __(self, *args, **kwds)
self.__set_prop erties()
self.__do_layou t()
# end wxGlade
def __set_propertie s(self):
# begin wxGlade: MyFrame.__set_p roperties
self.SetTitle(" frame_1")
# end wxGlade
def __do_layout(sel f):
# begin wxGlade: MyFrame.__do_la yout
self.Layout()
# end wxGlade
def StartSlave(self ):
# Get the window id
window_id = str(self.GetHan dle())
print 'In wx_app window_id =', window_id
script = 'tk_slave.py'
cmd = r"C:\python23\p ython.exe"
args = [script, script, window_id]
os.spawnv(os.P_ NOWAIT, cmd, args)
#self.Refresh()
# end of class MyFrame
class MyApp(wx.App):
def OnInit(self):
wx.InitAllImage Handlers()
frame_1 = MyFrame(None, -1, "")
self.SetTopWind ow(frame_1)
frame_1.Show(1)
frame_1.StartSl ave()
return 1
# end of class MyApp
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()
----------------------------
#!/usr/bin/env python
# Module: tk_slave.py
import sys
import Tkinter
class EmbeddedTk:
"""Create Embedded Tk app inside a wxPython app """
def __init__(self, window_id):
print 'Received window id =', window_id
self.window_id = window_id
self.root = Tkinter.Tk()
self.root.withd raw()
toplevel = Tkinter.Topleve l(use=self.wind ow_id)
#toplevel = Tkinter.Topleve l(self.root)
self.c = Tkinter.Canvas( toplevel, width=250, height=250,
bg='white', bd=0)
self.c.pack()
self.c.create_r ectangle(20,20, 230,230)
self.root.mainl oop()
if __name__ == '__main__':
if len(sys.argv) != 2:
sys.exit('Usage : python tk_slave.py window_id\n')
window_id = sys.argv[1]
EmbeddedTk(wind ow_id) 0 1962 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: omission9 |
last post by:
An application I have written is, suddenly it seems, throwing the
following error after being left in use for several hours. This does
not seem to occur with lighter usage. I am not 100% sure what causes
this? Anyone have any advice? Seen it before?
Traceback (most recent call last):
File "PythonCardPrototype\binding.pyo", line 304, in _dispatch
File "wxPython\events.pyo", line 23, in GetEventType
wxPython.wxc.wxPyAssertionError: C++...
|
by: Tim Williams |
last post by:
Hi.
I'm starting to learn wxPython and for an exercise I'm writing a
simple CSV file viewer. I just read in the CSV file and create a
wx.Grid with the data. I'm using Python 2.3.2 with wxPython 2.4.2.4.
Everything runs fine under linux, but when I try the same code on a
Win XP machine, I have a window, but the frame the grid is in isn't
seen until I do a minimize/maximize on the window. Besides that, it
seems to run fine. I tried to...
|
by: mitsura |
last post by:
Hi,
I have a question about wxPython.
On Windows systems, you can point your mouse over most items on your
desktop and a after a second or so, a small window will pop-up with
extra info about the thing your pointing at (try e.g. move your mouse
over the time in the right corner and a window will pop-up with the
date).
I was wondering this can be done with wxPython. I basically want to
create a wxTree object and when I point the mouse...
|
by: zdp |
last post by:
Dear all:
I made a window program by wxPython. Split windows, treectrl, listctrl
and textctrl are used. When I program in python, the look & feel of the
window controls are like the windos XP look & feel, with thin and flat
border (My os is window XP). It's natural because, as I know, wxPython
use native look and feel.
But when I convert the program to EXE file by Py2exe, and run it, the
look & feel is bad. It's just like the windows...
|
by: gundarap |
last post by:
Hello all,
I was wondering whether wxpython code can be embedded in HTML code.
I saw that We can do the converse i.e., we can write HTML code in wxpython code.
Jython is doing this favour with the help of Jython applets. But I want to work with wxpython.
I'm sure that some of them would have experienced the same problem.
Can you people suggest me some valuable solutions.
Thank you in advance.
| |
by: =?ISO-8859-15?Q?J=FCrgen_Kareta?= |
last post by:
Hello List,
my customer is looking for an application to show some simple 2d graphs
based on messured data.
I'm consider to use wxpython, matplotlib and py2exe to build and compile
this application. Mayby I also like to use WxMPL and inosetup. The
target platform is XP embedded. As I don't have XP embedded available, I
can't try it out.
|
by: rocksportrocker |
last post by:
Hi,
I want to visualize some vtk-files within a wxPython Window. Google
did not help me
very much, I only found some tools for Tk, what is no solution for me.
I'm sure I am not the first one who asks this question....
Any hints ?
|
by: Jimmy |
last post by:
Hi, all
I have been trying to use wxPython to design a GUI that will be
displayed on the panel on the top of desktop. that is when the
program starts, it will dwell on the panel to display some dynamic
information.
can anyone tell me in wxPython how to do this? thanks!
|
by: Leo Lee |
last post by:
I need a window's handle to be passed to external c++.
Thanks in advance
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |