[Rd] tcltk resizing when using tkgrid for layout
I've been able to figure out on my own how to do what I need in the largely undocumented tcltk package, but I've finally hit a wall. I can't even think of any sufficiently specific search terms to use for this. I'm trying to make the widgets in my tk window resize when the window is resized by clicking and dragging on its corners or edges. Instead they stay exactly where they are, and parts of them get cut off when the window is made smaller and reveal large empty spaces when the windows is made bigger. Looks terrible. I've tried doing tkconfig(mywidget,sticky='news') and all that does is stretch the widget out to the original window dimensions, but this doesn't help at all when the window is resized. From reading the TclTK documentation, it seems like the 'rowconfigure' and 'columnconfigure' methods of the grid are supposed to solve this problem by setting the 'weight' grid option. There exists a tkgrid.rowconfigure() command and the following invocation did not produce any errors... tkgrid.rowconfigure(mywidget,0,weight=1) ...but it didn't make the widget dynamically resize with the parent window either. Either I'm invoking it incorrectly, or it doesn't actually do what I think it does. Rather than posting my lengthy and complicated code, I'll post this example instead from bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ (a very helpful site without which I would never have been able to use the tcltk package at all). require(tcltk) tt<- tktoplevel() xscr<- tkscrollbar(tt, repeatinterval=5,orient="horizontal", command=function(...)tkxview(txt,...)) yscr<- tkscrollbar(tt, repeatinterval=5, command=function(...)tkyview(txt,...)) txt<- tktext(tt,bg="white",font="courier", xscrollcommand=function(...)tkset(xscr,...),yscrollcommand=function(...)tkset(yscr,...), wrap="none") tkgrid(txt,yscr) tkgrid(xscr) tkgrid.configure(yscr,sticky="ns") tkgrid.configure(xscr,sticky="ew") for (i in (1:100)) tkinsert(txt,"end",paste(i,"^ 2 =",i*i,", ")) tkconfigure(txt, state="disabled") tkfocus(txt) This creates a scrollable text window, and it suffers from exactly the problem I described above. My question is: what needs to be changed in order to make the tktext widget and its scrollbars automatically resize with the parent window? Thank you. [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] tcltk resizing when using tkgrid for layout
On 07/21/2010 09:36 AM, Alex Bokov wrote: > I've been able to figure out on my own how to do what I need in the > largely undocumented tcltk package, but I've finally hit a wall. I > can't even think of any sufficiently specific search terms to use for > this. Oops. Murphy's Law-- the answer only comes to you after you already send off an email to the experts. Sorry to bother you, I figured it out already. Here's how to make the code example I posted earlier... > require(tcltk) > tt<- tktoplevel() > xscr<- tkscrollbar(tt, repeatinterval=5,orient="horizontal", > command=function(...)tkxview(txt,...)) > yscr<- tkscrollbar(tt, repeatinterval=5, > command=function(...)tkyview(txt,...)) > txt<- tktext(tt,bg="white",font="courier", > > xscrollcommand=function(...)tkset(xscr,...),yscrollcommand=function(...)tkset(yscr,...), > wrap="none") > tkgrid(txt,yscr) > tkgrid(xscr) > tkgrid.configure(yscr,sticky="ns") > tkgrid.configure(xscr,sticky="ew") > for (i in (1:100)) tkinsert(txt,"end",paste(i,"^ 2 =",i*i,", ")) > tkconfigure(txt, state="disabled") > tkfocus(txt) > ...resize dynamically. All I had to do was add the following lines to the end of it: tkgrid.columnconfigure(tt,0,weight=1) tkgrid.rowconfigure(tt,0,weight=1) tkgrid.rowconfigure(txt,0,weight=1) tkgrid.columnconfigure(txt,0,weight=1) tkgrid.configure(txt,sticky='nswe') I had been so close before, I just didn't realize that if you have a complicated frame structure enclosing the widget, then the weight needs to be set on every enclosing frame, not just the widget itself. The hard part is figuring out which row and column a column-spanning widget really belongs to-- so far it seems to belong to the left-most and top-most one. Anyway, thanks to anybody who was going to answer this, hopefully I'm sending this soon enough to save you the effort of composing a reply. Have a great day! [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Recommendations for a quick UI.
Hi. This is my first post to this list, I seem to be graduating to from the r-help list. :-) I'm trying to wrap my R package in a GUI such that when the user launches the app, they see my GUI window and never interact with the R console at all. I don't have any fancy requirements for the GUI itself-- all it needs to do is collect input from the user and pass the input as arguments to an R function, which writes the results to a file. I read the R Extensions Manual section about GUIs, and it seems like overkill to write the thing in a compiled language and link against R as a library when there are dozens of different interpreted cross-platform GUI toolkits out there. Does anybody know of any functioning examples of packages (or other add-ons) with GUIs that run R silently in the background which I can study? Do they use the "R CMD BATCH" mechanism, or something else? Thanks. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Problems compiling a simple source package on MacOS X
Hello. I wrote a package (that contains C source) that I've been compiling and running on both Linux and Windows for about a year. However, that same source package fails to compile on MacOS (10.4.11, PowerPC G4, Xcode installed, gcc version 4.0.1, make version 3.80, ld version cctools-590.23.2.obj~17). There is nothing platform-specific in the code-- just numerical functions that I wrote in C so they would run faster. It's been a while since I hacked Macs... perhaps there is some preliminary step I'm overlooking that's so obvious to Mac R developers that nobody even bothers to mention it? I would greatly appreciate any suggestions on where I should look in order to troubleshoot this problem. Thank you kindly. PS: I get the following message when trying to compile either via R CMD INSTALL or via the "Packages & Data" menu within the R console: * installing to library '/Users/barshop_lab/Library/R/2.10/library' * installing *source* package 'Survomatic' ... ** libs ** arch - i386 gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include-fPIC -g -O2 -c haz.c -o haz.o gcc -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o Survomatic.so haz.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation ld: /Library/Frameworks/R.framework/../R.framework/R load command 17 unknown cmd field /usr/bin/libtool: internal link edit command failed make: *** [Survomatic.so] Error 1 ERROR: compilation failed for package 'Survomatic' * removing '/Users/barshop_lab/Library/R/2.10/library/Survomatic' * restoring previous '/Users/barshop_lab/Library/R/2.10/library/Survomatic' __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problems compiling a simple source package on MacOS X
Simon Urbanek wrote: In addition, please consider looking at R-SIG-Mac where Mac-related discussion takes place and this has been discussed before (stuffing the error in google gives exactly the relevant hit on the list...) Thank you, that was helpful. I'll try upgrading to Xcode 2.5. Very sorry to have bothered the list with a Google-able problem. I did try Googling first, but I was using "/usr/bin/libtool: internal link edit command failed" as the search term rather than the ld error above it. When I did the latter, I immediately found the post you referred to. I'll see if this fixes the problem. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel