Retrieval of widget property values
hi, here's my problem: let's say I have a function that uses some widget's property. How canI retireve the value of this property? For example, PopSize=IntVar(); popsize=Entry(root,width=10,textvariable=PopSize) def rand_opo_gen (self,event): popsize_start=#need to get the textvariable value from Entry popsize, not variable PopSize! pop1=random.random(popsize_start*2) Another option, of course, is that the variable PopSize acquires the value from Entry, but I can't see how to do it either cheers, alex -- http://mail.python.org/mailman/listinfo/python-list
Re: Interface centering
hi, I'm using Tkinter cheers, Alex On 24 окт, 20:26, Chris Rebert wrote: > On Sun, Oct 24, 2010 at 12:21 AM, Jah_Alarm wrote: > > sorry 4 the sillu question. > > > I've designed a GUI. How can I center on the screen? (i.e. it's always > > launched in the center of the screen) > > Which GUI toolkit did you use? > > Cheers, > Chris -- http://mail.python.org/mailman/listinfo/python-list
Interface centering
sorry 4 the sillu question. I've designed a GUI. How can I center on the screen? (i.e. it's always launched in the center of the screen) cheers, Alex -- http://mail.python.org/mailman/listinfo/python-list
numpad in idle
hi, here's my problem: I'm running IDLE in Ubuntu. For some reason numpad buttons do not work. I'm kinda used to this layout. Doesn anyone have an idea on how to switch it on? cheers, Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: update of elements in GUI
In MATLAB this command is drawnow, just in case On Aug 17, 9:49 pm, Jah_Alarm wrote: > thanks. The thing is, the objects actually get updated without this > command, but when I run the GUI outside of python shell (i.e. in > command prompt as python filename.py or compile it to .exe file) the > objects do not get updated. I tried > Label(mainframe,textvariable=var).grid(column=1,row=1).update_idletasks() > and mainframe.update_idletasks() but it still doesn't work. > > On Aug 17, 7:19 pm, Eric Brunel > wrote: > > > > > In article > > <24dc97b3-a8b5-4638-9cf5-a397f1eae...@q16g2000prf.googlegroups.com>, > > > Jah_Alarm wrote: > > > hi, I've already asked this question but so far the progress has been > > > small. > > > > I'm running Tkinter. I have some elements on the screen (Labels, most > > > importantly) which content has to be updated every iteration of the > > > algorithm run, e.g. "Iteration =" [i] for i in range(n), n=100. I'm > > > using the update_idletasks() command in the function itself after the > > > variable.set(...) command. The variable type is IntVar(), and the > > > mistake I'm getting is 'IntVar instance has no attribute > > > 'update_idletasks'. No updates are displayed, of course. > > > You have to call update_idletasks on a Tkinter *widget*, not a variable. > > You can call it on your window (Tk or Toplevel instance) or on your > > label for example. This way, it should work. > > > > Without the GUI the algorithm (it's a genetic algorithm) is working > > > fine, but I need to make it available to other people via GUI > > > > cheers, > > > > Alex -- http://mail.python.org/mailman/listinfo/python-list
message box in Tkinter
I need to display a message box at the click of a button. I od the following: from Tkinter import * def msg1(): messagebox.showinfo(message='Have a good day') Button(mainframe,text="About",command=msg1()).grid(column=360,row=36,sticky=W) I get the error msg 'global name 'messagebox' is not defined' When I try importing messagebox from Tkinter i get an error message that this module doesn't exist. thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: update of elements in GUI
thanks. The thing is, the objects actually get updated without this command, but when I run the GUI outside of python shell (i.e. in command prompt as python filename.py or compile it to .exe file) the objects do not get updated. I tried Label(mainframe,textvariable=var).grid(column=1,row=1).update_idletasks() and mainframe.update_idletasks() but it still doesn't work. On Aug 17, 7:19 pm, Eric Brunel wrote: > In article > <24dc97b3-a8b5-4638-9cf5-a397f1eae...@q16g2000prf.googlegroups.com>, > > Jah_Alarm wrote: > > hi, I've already asked this question but so far the progress has been > > small. > > > I'm running Tkinter. I have some elements on the screen (Labels, most > > importantly) which content has to be updated every iteration of the > > algorithm run, e.g. "Iteration =" [i] for i in range(n), n=100. I'm > > using the update_idletasks() command in the function itself after the > > variable.set(...) command. The variable type is IntVar(), and the > > mistake I'm getting is 'IntVar instance has no attribute > > 'update_idletasks'. No updates are displayed, of course. > > You have to call update_idletasks on a Tkinter *widget*, not a variable. > You can call it on your window (Tk or Toplevel instance) or on your > label for example. This way, it should work. > > > > > Without the GUI the algorithm (it's a genetic algorithm) is working > > fine, but I need to make it available to other people via GUI > > > cheers, > > > Alex -- http://mail.python.org/mailman/listinfo/python-list
update of elements in GUI
hi, I've already asked this question but so far the progress has been small. I'm running Tkinter. I have some elements on the screen (Labels, most importantly) which content has to be updated every iteration of the algorithm run, e.g. "Iteration =" [i] for i in range(n), n=100. I'm using the update_idletasks() command in the function itself after the variable.set(...) command. The variable type is IntVar(), and the mistake I'm getting is 'IntVar instance has no attribute 'update_idletasks'. No updates are displayed, of course. Without the GUI the algorithm (it's a genetic algorithm) is working fine, but I need to make it available to other people via GUI cheers, Alex -- http://mail.python.org/mailman/listinfo/python-list
random number generation
hi, I need to generate a binary array with a specified average proportion of 1s (e.g. [1 0 0 0 0 1 0 0] has this proportion = 25%). In Matlab I run something like random(m,n)http://mail.python.org/mailman/listinfo/python-list
Re: Textvariable display in label (GUI design)
On Aug 17, 3:32 am, Eric Brunel wrote: > In article > <993d9560-564d-47f0-b2db-6f0c6404a...@g6g2000pro.googlegroups.com>, > > Jah_Alarm wrote: > > hi, > > > pls help me out with the following issue: I wrote a function that uses > > a for loop that changes a value of a certain variable each iteration. > > What I want is by clicking a button in GUI (with the command bound to > > this function) this value each iteration is displayed in a textbox > > (label). So far only one (starting value) is displayed. > > > thanks, > > > Alex > > First, with posts like this, you're highly unlikely to get any useful > answer: please strip down your code to the smallest part that displays > the problem, post this code here, explaining what you're expecting and > what you're getting. Otherwise, people just won't know what you're > talking about unless they have a crystal ballŠ > > Now using my own crystal ball: if you don't return the control to the > GUI each time your variable is increased, the GUI won't get a chance to > update itself. Since you seem to use Tkinter (another wild guessŠ), you > probably need a call to the update_idletasks method on any Tkinter > widget each time you change your TextVariable. > > HTH > - Eric - Thanks, but where is this command used, in the button than runs the algorithm, the label or the function itself? -- http://mail.python.org/mailman/listinfo/python-list
Textvariable display in label (GUI design)
hi, pls help me out with the following issue: I wrote a function that uses a for loop that changes a value of a certain variable each iteration. What I want is by clicking a button in GUI (with the command bound to this function) this value each iteration is displayed in a textbox (label). So far only one (starting value) is displayed. thanks, Alex -- http://mail.python.org/mailman/listinfo/python-list
nonuniform sampling with replacement
I've got a vector length n of integers (some of them are repeating), and I got a selection probability vector of the same length. How will I sample with replacement k (<=n) values with the probabilty vector. In Matlab this function is randsample. I couldn't find anything to this extent in Scipy or Numpy. thanks for the help Alex -- http://mail.python.org/mailman/listinfo/python-list