Hi,
I'm new to wxpython, and the following code is my first serious
attempt:
#~ start code
import wx
class MyPanel(wx.Pane l):
def __init__(self, parent, id):
wx.Panel.__init __(self, parent, id)
self.parent = parent
button = wx.Button(self, -1, "Refresh")
button.SetPosit ion((100, 100))
button.SetFocus ()
self.Bind(wx.EV T_BUTTON, self.OnCloseMe, button)
def OnCloseMe(self, event):
self.parent.f_r edraw(self)
pass
class MyFrame(wx.Fram e):
def __init__(
self, parent, ID, title, pos=wx.DefaultP osition,
size=wx.Default Size, style=wx.DEFAUL T_FRAME_STYLE
):
wx.Frame.__init __(self, parent, ID, title, pos, size, style)
def f_redraw(self, kill_window):
kill_window.Des troy()
MyPanel(self, -1)
#~ self.SendSizeEv ent()
wxApp = wx.App()
f = MyFrame(None, -1, "App Title")
MyPanel(f, -1)
f.Show()
wxApp.MainLoop( )
#~ end code
My problem is: when I press the "refresh" button, the new panel is
painted only as a 20x20 pixels square on the top right side of the
frame. If I resize the frame, the panel is repainted correctly (that's
why I inserted the self.SendSizeEv ent() line - commented above).
Is there something I'm missing, or this is normal ?
I'm using python 2.4.3 and wxpython 2.8.1.1 unicode, on WinXP SP2.
Windows extensions are also installed. 3 2538
On 24 Jan 2007 13:35:51 -0800, ci*******@yahoo .com <ci*******@yaho o.comwrote:
Hi,
I'm new to wxpython, and the following code is my first serious
attempt:
#~ start code
import wx
class MyPanel(wx.Pane l):
def __init__(self, parent, id):
wx.Panel.__init __(self, parent, id)
self.parent = parent
button = wx.Button(self, -1, "Refresh")
button.SetPosit ion((100, 100))
button.SetFocus ()
self.Bind(wx.EV T_BUTTON, self.OnCloseMe, button)
def OnCloseMe(self, event):
self.parent.f_r edraw(self)
pass
class MyFrame(wx.Fram e):
def __init__(
self, parent, ID, title, pos=wx.DefaultP osition,
size=wx.Default Size, style=wx.DEFAUL T_FRAME_STYLE
):
wx.Frame.__init __(self, parent, ID, title, pos, size, style)
def f_redraw(self, kill_window):
kill_window.Des troy()
MyPanel(self, -1)
#~ self.SendSizeEv ent()
wxApp = wx.App()
f = MyFrame(None, -1, "App Title")
MyPanel(f, -1)
f.Show()
wxApp.MainLoop( )
#~ end code
My problem is: when I press the "refresh" button, the new panel is
painted only as a 20x20 pixels square on the top right side of the
frame. If I resize the frame, the panel is repainted correctly (that's
why I inserted the self.SendSizeEv ent() line - commented above).
Is there something I'm missing, or this is normal ?
I'm using python 2.4.3 and wxpython 2.8.1.1 unicode, on WinXP SP2.
Windows extensions are also installed.
This is expected. Note that your "redraw" is no such thing - you are
destroying the window and creating a new one.
A feature of the wx.Frame class is that if it has one and only one
child, that child is sized to fill the client area of the frame.
However, this sizing happens in response to size events of the frame
itself, so when you create the new panel, it is shown at its default
size until you resize the frame (or emulate resizing the frame via
SendSizeEvent).
On Wed, 24 Jan 2007 13:35:51 -0800, citronelu wrote:
Hi,
I'm new to wxpython, and the following code is my first serious
attempt:
#~ start code
import wx
class MyPanel(wx.Pane l):
def __init__(self, parent, id):
wx.Panel.__init __(self, parent, id)
self.parent = parent
button = wx.Button(self, -1, "Refresh")
button.SetPosit ion((100, 100))
button.SetFocus ()
self.Bind(wx.EV T_BUTTON, self.OnCloseMe, button)
def OnCloseMe(self, event):
self.parent.f_r edraw(self)
pass
class MyFrame(wx.Fram e):
def __init__(
self, parent, ID, title, pos=wx.DefaultP osition,
size=wx.Default Size, style=wx.DEFAUL T_FRAME_STYLE
):
wx.Frame.__init __(self, parent, ID, title, pos, size, style)
def f_redraw(self, kill_window):
kill_window.Des troy()
MyPanel(self, -1)
#~ self.SendSizeEv ent()
wxApp = wx.App()
f = MyFrame(None, -1, "App Title")
MyPanel(f, -1)
f.Show()
wxApp.MainLoop( )
#~ end code
My problem is: when I press the "refresh" button, the new panel is
painted only as a 20x20 pixels square on the top right side of the
frame. If I resize the frame, the panel is repainted correctly (that's
why I inserted the self.SendSizeEv ent() line - commented above).
Is there something I'm missing, or this is normal ?
I'm using python 2.4.3 and wxpython 2.8.1.1 unicode, on WinXP SP2.
Windows extensions are also installed.
Consider using sizers, you'll need them anyway. They do such things for
you, and many other things too.
The help file has a good chapter on this: Working with sizers.
Kind regards
Morpheus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Curzio Basso |
last post by:
Hi all,
I have a problem for which I wasn't able to find an answer anywhere
else, maybe someone can give me a hint...
I designed with XRCed a small GUI (the code is at the bottom of the
message) made up of a menu and a frame in which there are two panels,
placed by an horizontal sizer.
Now, what I would like to do is to be able to load...
|
by: Grant Edwards |
last post by:
Can anybody recommend a good book on wxPython? Are there any
books on wxPython?
I've been trying to learn wxPython and/or wax for a few weeks,
and I'm just not getting it.
wxWindows seems to be more low-level than the other GUI
toolkits I've used (Tk, GTK, and Trestle), and there are all
sorts exposed details in wxWindows/wxPython...
|
by: mdk.R |
last post by:
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.py", line 10, in ?
from wxPython.wx import *
File "D:\Python23\Lib\site-package
import _wx
|
by: John Salerno |
last post by:
I'm using the sample code of the file 'simple.py' and trying to make a
single window with a panel in it, but I keep getting an error. Here's my
code: (I know I might need something else, like a Show() method for the
panel, but the error stops on the first panel line anyway. I've tried a
Layout() method but it didn't get that far).
import wx...
|
by: John Salerno |
last post by:
I'd be curious to know if this works any differently on other
computers/platforms or while other things are happening in the
background. I can't tell if it's the Timer object that isn't keep
accurate time (although a test with time.time() seems to show that it
is), or if I'm just messing up my algorithm to fill the progress bar. If
I put in...
| |
by: zxo102 |
last post by:
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()",...
|
by: Che M |
last post by:
Hello,
I'm curious if it is easy to get panels on your wxPython apps to have backgrounds which are given by a jpg or other bitmap. I found http://www.5etdemi.com/blog/archives/2006/06/making-a-panel-with-a-background-in-wxpython/ on a blog, which seems to be the way to do it, but I am too new to Python and wxPython to understand how to...
|
by: Tyler |
last post by:
Hello All:
I am currently working on a project to create an FEM model for school.
I was thinking about using wxPython to gather the 12 input variables
from the user, then, after pressing the "Run" button, the GUI would
close, and the 12 input variables would then be available for the rest
of the program.
So far, what I have been able to...
|
by: Andrea Gavana |
last post by:
Hi Diez & All,
Do you mind explaining "why" you find it *buttugly*? I am asking just
out of curiosity, obviously. I am so biased towards wxPython that I
won't make any comment on this thread in particular, but I am curious
to know why some people find it "ugly" or "bad" or whatever. It has
its own bugs and missing features, of course, but...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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...
| |