Code Monkey home page Code Monkey logo

gwidgets2tcltk's People

Contributors

ale275 avatar jverzani avatar maclean avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

maclean ale275

gwidgets2tcltk's Issues

save and restore state

This question https://stackoverflow.com/questions/51136723/gwidgets-how-to-save-users-work-in-the-application/51213597#51213597 exposed a few issues with tcltk2:

  • this should not change widget state svalue(ojb, index=TRUE) <- svalue(obj, index=TRUE)
  • this should not change widget state obj[] <- obj[].

However, for gtable the column size changes. For gedit there is an issue (maybe) with empty states. And the answer there doesn't seem to work for setting the value after setting the values.

[macOS] Error in tests on 10.6: `X connection to /tmp/launch-AmJfqT/:0 broken (explicit kill or server shutdown)`

@jverzani I am pretty sure this is a problem on my side and not a bug in the package. But maybe you know why this may happen?

R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.0.0d2 (32-bit)

> library(testthat)
> library(gWidgets2)
Loading required package: digest
> options(guiToolkit="tcltk")
> 
> f <- list.files(system.file("tests", package="gWidgets2"), full=T)
> f <- Filter(function(x) !grepl("README", x), f)
> f <- Filter(function(x) !grepl("html", x), f)
> ## issues
> f <- Filter(function(x) !grepl("df.R", x), f)
> f <- Filter(function(x) !grepl("text.R", x), f)
> f <- Filter(function(x) !grepl("tree.R", x), f)
> 
> sapply(f, function(i) {
+   message("testing ", i)
+   source(i)
+ })
testing /opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/gWidgets2/tests/button.R
Loading required package: gWidgets2tcltk
Loading required package: memoise
Loading required package: tcltk
X connection to /tmp/launch-AmJfqT/:0 broken (explicit kill or server shutdown).

tablelist and missing values

I'm currently shamelessly ;-) reusing your code for the tablelist widget to use it in a R Commander plug-in I'm developing. That's a very useful widget!

While doing so I discovered that if you introduce missing values by removing the contents of a cell, or by putting text in a numeric cell, the NAs always appear at the end of the table, instead of being inserted to the correct place. This comes from tcl_parse().

It looks like this problem can be fixed by compeletely stopping using tcl_parse(). If you define tl_get_column_raw() as follows:
tl_get_column_raw <- function(tbl, j) {
tcl(tbl, "getcolumns", j-1)
}

then calling as.numeric(), as.character() and friends on the result works as expected, and even sets NAs in the correct places. You just need to adapt coerce_raw.factor() this way:
coerce_raw.factor <- function(x, values) factor(as.character(values))

Hope this is useful. Probably the code was written at a time when tcltk did not handle Tcl vectors correctly.

Unable to install gWidgets2tcltk on RStudio + R 4.1.0

I get these messages:
Warning message:
no DISPLAY variable so Tk is not available
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
[tcl] invalid command name "font".

Error: unable to load R code in package ‘gWidgets2tcltk’
Execution halted

  • installing to library ‘/opt/R/4.1.0/lib/R/library’
  • installing source package ‘gWidgets2tcltk’ ...
    ** package ‘gWidgets2tcltk’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** demo
    ** inst
    ** byte-compile and prepare package for lazy loading
    ERROR: lazy loading failed for package ‘gWidgets2tcltk’
  • removing ‘/opt/R/4.1.0/lib/R/library/gWidgets2tcltk’

Anything that I can do?

Icons/ expand=TRUE in gnotebook

This is from stack overflow. Showing icons don't work as expected, and the two expand=TRUE commands raises an error.

library(gWidgets) 
library(gWidgetstcltk) 

w <- gwindow("Example") 
visible(w) <- T 

mbl <- list() 
mbl$About$handler = function(h,...) {print("About"); gmessage("About clicked")} 
mbl$About$icon = "help_topic" 
mbl$Help$handler = function(h,...) print("Help") 
mbl$Help$icon = "help" 

mb <- gmenu(mbl, container = w) 

g <- ggroup(horizontal = F, container = w) 

nb <- gnotebook(cont = g) ## notebook 

Tab1 <- ggroup(horizontal = FALSE, cont=nb, label="Tab 1", expand = T) 
Tab2 <- ggroup(horizontal = FALSE, cont=nb, label="Tab 2", expand = T) 

g1 <- gframe("Frame", cont = Tab1, horizontal = T, expand=TRUE) 
SomeButton <- gbutton("Click", cont=g1) 
OtherButton <- gbutton("Close", cont=g1) 

issue with gtable?

Why does this not work?

library(gWidgets2)
options(guiToolkit="tcltk")
d <- mtcars

w <- gwindow(visible=FALSE)
g <- ggroup(horizontal=FALSE, cont=w)
glabel("Select a variable to become a factor", cont=g)

nms <- names(d)
kls <- sapply(d, function(x) class(x)[1])
vars <- gtable(data.frame(Name=nms, Class=kls, stringsAsFactors=FALSE),
               cont=g, expand=TRUE)

addHandlerDoubleclick(vars, handler=function(h,...) {
  ind <- svalue(vars, index=TRUE)
  d[[ind]] <<- as.factor(d[[ind]])
  vars[ind,2] <- "factor"
})

visible(w) <- TRUE

richie cotton's example on fedora

Hi John: I just started playing with gWidgets2tlck2 and I am on fedora 19. I am
going through ezamples and I found richie cotton's example interesting. But when
I tried to run the code below, it blows up in the sense that everything just
dissapears when I run that line. I have other examples that I'll try ( some are yours ) so its okay but I just wanted to give you a heads up about it. There's definitely a chance that I'm doing something strange that's causing it but I think I typed in the code correctly.

Also, I can be reached at [email protected] if you want to write me
there. It's actually better for me if you can send there but if you want me to
stay here and check in, I can do that. All the best. It's amazing what you'
ve done. Learning it is definitely a job in itself. Writing it must have been
a job to the nth where n goes to infinity !!!!! All the best.

==========================================================

win <- gwindow("Tab delimited file load example")
grp_name <- ggroup(container = win)

lbl_data_frame_name <- glabel(
"Variable to save data to: ",
container = grp_name
)

txt_data_frame_name <- gedit("dfr", container = grp_name)

BLOWS UP AT THIS LINE

grp_upload <- ggroup(container = win)

[macOS / Linux] `gWidgets2tcltk` fails to install: `Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] invalid command name "font".`

  * installing *source* package ‘gWidgets2tcltk’ ...
  ** package ‘gWidgets2tcltk’ successfully unpacked and MD5 sums checked
  ** using staged installation
  ** R
  ** demo
  ** inst
  ** byte-compile and prepare package for lazy loading
  Warning message:
  In fun(libname, pkgname) :
    no display name and no $DISPLAY environment variable
  Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : 
    [tcl] invalid command name "font".
  
  Error: unable to load R code in package ‘gWidgets2tcltk’
  Execution halted
  ERROR: lazy loading failed for package ‘gWidgets2tcltk’
  * removing ‘/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-gWidgets2tcltk/R-gWidgets2tcltk/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/gWidgets2tcltk’
  Command failed:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-gWidgets2tcltk/R-gWidgets2tcltk/work/gWidgets2tcltk" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-gWidgets2tcltk/R-gWidgets2tcltk/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library 
  Error: Failed to destroot R-gWidgets2tcltk: command execution failed

Unable to load gWidgets2tcltk in RStudio on M1 Mac

When attempting to load the package in either R.app or RStudio on a MacStudio M1 Pro, I get the following error in both:

Error: package or namespace load failed for ‘gWidgets2tcltk’:
.onAttach failed in attachNamespace() for 'gWidgets2tcltk', details:
call: structure(.External(.C_dotTclObjv, objv), class = "tclObj")
error: [tcl] can't create procedure "tablelist::extendConfigSpecs": unknown namespace.

Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
[tcl] invalid command name "bind".

R 4.2.0
RStudio 2022.02.2
gWidgets2tcltk 1.0-8

Web search for the problem brought me to this git repo.

gcheckboxgroup with table

Karim's issue:

library("gWidgets2")
myMatrix = matrix(letters[1:10], ncol=2)
cb = gcheckboxgroup(myMatrix, cont=gwindow(), use.table=TRUE)
cb[] <- myMatrix[1:2,]

Error: unable to load R code in package gWidgets2tcltk

While installing gWidget2tcltk I have experienced the following error:

* installing *source* package gWidgets2tcltk ...
** package gWidgets2tcltk successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
  [tcl] failed to allocate font due to internal system font engine problem.

Error: unable to load R code in package gWidgets2tcltk
Execution halted
ERROR: lazy loading failed for package gWidgets2tcltk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.