Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8611015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:16:01+00:00 2026-06-12T04:16:01+00:00

I have created a progress bar to keep tabs on the execution of some

  • 0

I have created a progress bar to keep tabs on the execution of some R scripts. And I want to insert a custom icon in the bar instead of the default ‘Tk’ one. I am able to do this on Windows using a .ico file and the following command

tcl('wm', 'iconbitmap', .win, 'Icon.ico')

But I am a loss about how to do the same in Mac OSX and Linux. Obviously, the .ico format doesn’t work but neither does .png, .jpg, .bmp, .xbm or .xpm. Any suggestion on how I could proceed? Sample image and progress bar code attached below:-

Sample image http://tinypic.com/r/jt8efn/6 – http://tinypic.com/r/jt8efn/6

tkProgressBar2 <- function (title = 'Test progress bar', label = '', min = 0, max = 100, initial = 0, width = 300, userfn='helvetica', backg='white') {
  useText <- FALSE
  have_ttk <- as.character(tcl('info', 'tclversion')) >= '8.5'
  if (!have_ttk && as.character(tclRequire('PBar')) == 'FALSE') useText <- TRUE
  .win <<- tktoplevel(background=backg)
  tkfocus()
  tcl('wm', 'geometry', .win, '500x100+450+350')
  tcl('wm', 'iconbitmap', .win, '@Icon.xbm')
  .val <- initial
  .killed <- FALSE
  tkwm.geometry(.win, sprintf('%dx80', width + 40))
  tkwm.title(.win, title)
  fn <- tkfont.create(family = userfn, size = 12)
  if (useText) {
    .lab <- tklabel(.win, text = label, font = fn, padx = 0, background=backg)
    tkpack(.lab, side = 'left')
    fn2 <- tkfont.create(family = userfn, size = 16)
    .vlab <- tklabel(.win, text = '0%', font = fn2, padx = 20, background=backg)
    tkpack(.vlab, side = 'right')
    up <- function(value) {
      if (!is.finite(value) || value < min || value > max) return()
      .val <<- value
      tkconfigure(.vlab, text = sprintf('%d%%', round(100 * (value - min)/(max - min))))
    }
  } else {
    .lab <- tklabel(.win, text = label, font = fn, pady = 0, background=backg)
    .tkval <- tclVar(0)
    tkpack(.lab, side = 'top')
    tkpack(tklabel(.win, text = '', font = fn, background=backg), side = 'bottom')
    pBar <- if (have_ttk)
      ttkprogressbar(.win, length = width, variable = .tkval) else
        tkwidget(.win, 'ProgressBar', width = width, variable = .tkval)
    tkpack(pBar, side = 'bottom')
    up <- function(value) {
      if (!is.finite(value) || value < min || value > max) return()
      .val <<- value
      tclvalue(.tkval) <<- 100 * (value - min)/(max - min)
    }
  }
  getVal <- function() .val
  kill <- function() if (!.killed) {
    tkdestroy(.win)
    .killed <<- TRUE
  }
  title <- function(title) tkwm.title(.win, title)
  lab <- function(label) tkconfigure(.lab, text = label)
  tkbind(.win, '<Destroy>', function() stop())
  up(initial)
  structure(list(getVal = getVal, up = up, title = title, label = lab, kill = kill), class = 'tkProgressBar')
}

pb <- tkProgressBar2(title='Performing k-Means clustering', label='Some information in %', min=0, max=100, initial=0, width=400, userfn='verdana', backg='white')
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:16:03+00:00Added an answer on June 12, 2026 at 4:16 am

    On Linux you set the icon with wm iconphoto; wm iconbitmap does something else entirely. To do that, you’ll need to create a photo image with the image data in it.

    I’m guessing that you write this in R as:

    tcl('wm', 'iconphoto', .win, tcl('image', 'create', 'photo', '-file', 'Icon.gif'))
    

    I’m not quite sure which image formats are supported by the version of Tk you’re using, including any image format support packages it has available. The minimal set is GIF and PPM unless you’re (bravely) using 8.6, when PNG is also available by default.

    (You can also create the content of a photo image programatically, but that’s slow for various reasons.)

    OSX doesn’t have window icons in the same sense; it’s normal for each minimized window to just show a snapshot of itself when it is minimized to the dock.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm downloading some pictures and have created a progress bar. I'm using asynchronous mode
I want to Update the Progress bar in my application. I have created a
In my app i have created one custom alert view with one progress bar
I have created a website loading progress bar using Jquery UI Progress bar. This
I have created a C# COM DLL which is essentially an enhanced progress bar
Hi i have a problem updating a progress bar. First i have a custom
I have created an activity in which I have created a progress bar as
I have to create a progress bar in a webapp. I need a thread
I have created some JQuery that will expand a div 'popup' on hover and
I have created a custom post type named People. I have created a page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.