473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Refreshing a wx.Panel

Elias Alhanatis
Dear friends,

First of all , i wish a Happy New Year to all of you!!!!

I have been learning Python and the Tkinter GUI package for the last 6 months ,
and now i am trying to rewrite a program i made using the wxPython package.
I have a toolbar , a panel ( on which all the 'action' takes place ) ,and a status bar.
My question is , how do i delete and then redraw the panel? Here is an example of the code i use:

Expand|Select|Wrap|Line Numbers
  1. # -*- coding: cp1253 -*-
  2. from wxPython.wx import *
  3. import wx
  4.  
  5.  
  6. class ApplicationFrame(wxFrame):
  7.     def __init__(self, parent, ID, title):
  8.         wxFrame.__init__(self, parent, ID, title,
  9.                          wxDefaultPosition, wxSize(720, 450))
  10.         self.CreateStatusBar()
  11.         self.SetStatusText(u" StatusBar : Σύντομη περιγραφή της υπό επιλογή λειτουργίας")
  12.         toolbar1 = self.CreateToolBar( wx.TB_HORIZONTAL | wx.TB_TEXT | wx.BORDER_DOUBLE)
  13.         toolbar1.SetToolBitmapSize((70,63))
  14.         toolbar1.SetBackgroundColour("#d5ab6c")
  15.         toolbar1.AddSimpleTool(10, wx.Bitmap('Apothiki_Button.gif'),u" Αποθήκη ",u" Άνοιγμα καταλόγου αποθήκης")
  16.         toolbar1.AddSimpleTool(20, wx.Bitmap('Pelates_Button.gif'),u" Πελάτες ",u" Άνοιγμα καταλόγου πελατών")
  17.         toolbar1.AddSimpleTool(30, wx.Bitmap('Promitheftes_Button.gif'),u" Προμηθευτές ",u" Άνοιγμα καταλόγου προμηθευτών")
  18.         toolbar1.AddSimpleTool(40, wx.Bitmap('Exit_Button.gif'),u" Έξοδος ",u" Έξοδος από το πρόγραμμα")
  19.         toolbar1.Realize()
  20.         EVT_MENU(self,40,self.TimeToQuit)
  21.         EVT_MENU(self,20,self.Pelates)
  22.         EVT_MENU(self,30,self.ChangeColour)
  23.         self.panel=wx.Panel(self,id=50,style=wx.BORDER_SUNKEN,name=" My Panel")
  24.         self.panel.SetBackgroundColour("red")
  25.         self.panel.Show()
  26.         self.panel.Bind(EVT_LEFT_DCLICK,lambda event:self.panel.SetBackgroundColour("blue"))
  27.  
  28.  
  29.     def ChangeColour(self,event):
  30.         self.panel.SetBackgroundColour("skyblue")
  31.         self.panel.Refresh(true)
  32.  
  33.     def Pelates ( self,event):
  34.         pass
  35.  
  36.     def TimeToQuit(self, event):
  37.         self.Close(true)
  38.  
  39.  
  40. class MyApp(wxApp):
  41.     def OnInit(self):
  42.         frame = ApplicationFrame(NULL, -1, "Midas wx_Python")
  43.         frame.Show(true)
  44.         self.SetTopWindow(frame)
  45.         return true
  46.  
  47. app = MyApp(0)
  48. app.MainLoop()
As you can see , i try both ways to change the colour of the panel , but none of
them works properly. I have noticed that with the Bind method , the panel gets refreshed when i drag and move on it another window from my desktop.
I am using Python 2.5.1 on Windows Vista.

Thank you all in advance!!!!

Elias
Dec 30 '07 #1
1 2221
Puzzle solved!!!!

No need to answer this post!!

Elias
Jan 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: justin__devine | last post by:
I have a quick question here is my widget it is a Radiobox. rb = wx.RadioBox( self, -1, "Quick Sites", (10, 215), (425, 70), labellist, 5, wx.RA_SPECIFY_COLS ) self.rb = rb later on in the...
1
by: LRD | last post by:
Form not refreshing after autopostback unless keyboard or mouse move Hi, We created several new ASP.NET C# forms for our intranet. In each form we use panels for different sections of the...
3
by: Seansan | last post by:
Hi, Does anyone know how I can disable the click sound that is heard when a IFRAME is reloaded? I use javascript to reload an IFRAME every minute or so and I keep hearing this "click". thx...
31
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and...
1
by: evanburen | last post by:
When a user clicks the "Close Panel Manager" link on page2.htm I would like page1.htm to be refreshed without losing the address in browser1/page1.htm. Page2.htm is a child popup from parent...
3
by: evanburen | last post by:
I use this code in a popup to refresh the parent browser. It works fine as long as the user actually clicks on this link but does not work in cases where the user closes the child popup through the...
0
by: Monty | last post by:
Sometimes, after designing for over an hour or so, I notice that when I have selected an object, like a panel or really just anything, the properties with not refresh to show its details. Closing...
9
by: Mark Denardo | last post by:
This is related to another post I submitted, but I'll be more precise this time. I have a web page that contains an Image webcontrol that loads its image by: Image1.ImageUrl="<username>.jpg",...
3
by: Cecco | last post by:
Hi everybody, I just made a simple control called clock for including a "windows sidebar modern clock" in my applications. It works fine but there some "flashing effect" when the control...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
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...

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.