Dear all, I have a window with several textctrl. I am trying to intercept the mouse click in each control, open a filedialog and set the value of the specific control with the selected file. The problem is that I would like to avoid creating hundreds of similar functions for each control, so I would like to bind one single function to all of them. What I got so far is the following def onSecond(self, event): focus = wx.TextCtrl.FindFocus() if focus.GetValue()=="": focus.SetValue("loading...") dlg = wx.FileDialog(self, message="Choose the first image (base image)",wildcard = filters, style = wx.MULTIPLE) if dlg.ShowModal() == wx.ID_OK: …

Member Avatar
Member Avatar
+0 forum 1

This code snppet uses the wx.lib.filebrowsebutton.FileBrowseButton widget to pick a file, in this case a '.wav' sound file, and plays it with the wx.Sound widget.

Member Avatar
Member Avatar
+1 forum 1

Dear friends, is there a way to execute a dos command in a frame inside a wx.window GUI (and not in the usual external window)? Thanks

Member Avatar
Member Avatar
+0 forum 5

This small code example shows you how to approach the beginning concept of an very simple "IDE" for Python.

Member Avatar
+0 forum 0

I want to be able to have a set of panels of vertical panels that remain the same size, but I want to have a vertical scroll bar that will allow me to scroll in the window. Right now I'm using a wx.ScrolledPanel and adding panels to that and putting them in the sizer but nothing really shows up on the screen import wx import wx.lib.scrolledpanel as scrolled class josh(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, wx.GetApp().TopWindow, title='Title',size=(800,600)) arr= ['Q1.......','Q2.......','Q3.......','Q4.......','Q5.......','Q6.......','Q7..............','Q8..........'] scroll=scrolled.ScrolledPanel(self, -1) #scroll.SetScrollbars(1,1,1,1) panelList = [] commentList = [] count = 1 sizer = wx.BoxSizer(wx.VERTICAL) for p in arr: panelList.append(wx.Panel(scroll ,-1, …

Member Avatar
+0 forum 0

Hello, I am newish to wxPython and I am attmpting to make a text editor Everytime it attempts the open file code it gets this error: IOError: [Errno 22] invalid mode ('r') or filename: u'' WHY!!! here is the code... import wx import os wildcard = "Text file (*.txt)|*.txt;|"\ "All files (*.*)|*.*" class frame(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'Simple Text Control!', size=(478,300)) panel=wx.Panel(self) edit=wx.TextCtrl(panel,1,size=(300,220), pos=(2,2), style = wx.TE_MULTILINE) btn=wx.Button(panel, -1, "Open File", pos=(342,15), size=(95,32)) self.Bind(wx.EVT_BUTTON, self.Open, btn) def Open(self, event): dlg = wx.FileDialog( self, message="Grab your file...", defaultFile="", wildcard=wildcard, style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR ) self.dirname=dlg.GetDirectory() self.filename=dlg.GetFilename() if dlg.ShowModal() == wx.ID_OK: filehandle=open(os.path.join(self.dirname, …

Member Avatar
Member Avatar
+0 forum 1

Friends, kindly help me how to update the progress bar in WX Widgets python while copying folder in windows... i tried searching a lot.. please do help me out.. Thanks in advance! Ganesh R

Member Avatar
Member Avatar
+0 forum 1

Dear all, I built 2 script to manage 2 different frames (which I will then convert to exe with py2exe). Frame 1 (GG1) is like this [CODE]import wx # begin wxGlade: extracode # end wxGlade class MyFrame(wx.Frame): functions here ... if __name__ == "__main__": app = wx.PySimpleApp(0) wx.InitAllImageHandlers() GG1 = MyFrame(None, -1, "") app.SetTopWindow(GG1) GG1.Show() app.MainLoop() [/CODE] Everything is fine. Now I would like to open another independent frame (GG2) [CODE]import wx # begin wxGlade: extracode # end wxGlade class MyFrame(wx.Frame): functions here ... if __name__ == "__main__": app = wx.PySimpleApp(0) wx.InitAllImageHandlers() GG2= MyFrame(None, -1, "") app.SetTopWindow(GG2) GG2.Show() app.MainLoop() [/CODE] …

Member Avatar
Member Avatar
+0 forum 2

I'm looking at getting started with [URL="http://www.wxwidgets.org/"]wxWidgets[/URL]. I currently use Dev C++ as my IDE for C++ coding. wx Widgets looks very promising and could speed up my development if used. Though what the site doesn't state (at-least none that I've found) is whether it's an IDE of its own or does it interrate with other IDEs. Will it integrate with Dev C++ or must I switch. Infact, on the topic of switching IDEs, should I switch from DevC++ to Code::Blocks or something else? I understand Dev C++ is no longer developed yet there is something called wxDevC++ but it …

Member Avatar
Member Avatar
+0 forum 2

Hi guys, I'm having problems with wxPython. If I put in the header of my files from wxPython.wx import * it works fine, even if I see a DeprecationWarning about it. If I write import wx (as also wxformbuilder would do) I get errors like name wxPySimpleApp is not defined The point is not how to fix the last error (name not defined), I can re-write the code accordingly. The problem is why the import wx doesn't give any output! Thanks for your help

Member Avatar
+0 forum 0

I was trying to create a simple Python GUI with a label on a frame. I can't get the label's position and size to work: [code]# a simple wxPython GUI program # showing a label with color text # however, label position and size do not work! import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, -1, mytitle, size=mysize) self.SetBackgroundColour("white") s = "Red letters on a yellow background" label = wx.StaticText(self, -1, label=s, pos=(20, 100), size=(200, 30)) # set fg and bg color of label label.SetForegroundColour("red") label.SetBackgroundColour("yellow") app = wx.App(redirect=True) # create a frame of given size = …

Member Avatar
Member Avatar
+0 forum 1

Hi All, Been coding Python on and off for a year now, but only just started looking at wx. Got a problem in a larger project I'm working on, trying to remove all items from a GridSizer - I've created the following test code to demonstrate the problem, but to summarize: [LIST] [*]calling .Remove(x) on the [I]last[/I] element of the grid returns True but doesn't remove the object from the GUI [*]calling .Clear() doesn't remove any items from the GUI [/LIST] Anyway, code sample... [CODE] import wx class Test: def __init__(self): app = wx.App(False) frame = wx.Frame(None, wx.ID_ANY, "Test App") …

Member Avatar
Member Avatar
+0 forum 5

Hi there, I am very new to python and wx and all that and I have a problem with my program, I'm trying to save what's been drawn on the screen,but just cant make it work. Here is the code: [CODE] import wx class MPanel(wx.Window): def __init__(self, parent): wx.Window.__init__(self, parent) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetClientSizeWH(500,500) self.SetBackgroundColour("WHITE") #... self.Bind(wx.EVT_PAINT, self.on_paint) self.Bind(wx.EVT_CHAR, self.on_character) #some functions here... def on_paint(self,event): dc = wx.AutoBufferedPaintDC(self) dc.Clear() #dc.draw some stuff def on_character(self,event): if key==115: #s #img = ........? #img.SaveFile("image1.jpg", wx.BITMAP_TYPE_JPEG) class MFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id,"titleee") self.panel = MPanel(self) app = wx.App(False) frame = MFrame(parent=None, id) frame.Show(True) …

Member Avatar
Member Avatar
+0 forum 1

why does this fail to call any event? [CODE=python] def StartTimer(self, timer = 1): timer_data = { 1: (self.TimeKeeper, False, 50), 2: (self.InterimSearch, True, 200), 3: (self.InterimCurSearch, True, 200), 4: (self.SetOpaque, False, 50), 5: (self.DisplayPhoto, True, 200) } function, singlefire, time = timer_data[timer] timer = str(timer) # class of constants ID = eval('con.TIMER'+timer) exec('timer = self.t'+timer+' = wx.Timer(self, id=ID)') timer.Bind(wx.EVT_TIMER, Dispatcher(function), id=ID) timer.Start(time, singlefire) self.Timers[timer] = 1[/CODE] [CODE=python]class Dispatcher: """ An intermediary between binded events and there routines. Allows altering of routines without destroying the initial references """ def __init__(self, aFunction): import __main__ self.name = aFunction.__name__ if hasattr(aFunction, 'im_self'): self.container …

Member Avatar
+0 forum 0

I've been using the Aspects module to trace and patch routines on the fly in my wxPython app. The problem I've run in to occurs when wx binds an event to a function. ie: an event is binded to function <function func at 0x03969A30> after aspects.with_wrap() func now becomes <function func at [B][I]0x03973030[/I][/B]> the namespace is updated but is seems that wx maintains a copy of the old function in memory rather than just a reference. When the event is triggered the old routine is called rather than the new 'patched' one. So far the only dependable way to fix …

Member Avatar
+0 forum 0

The End.