# How do we programmatically set sprite size?

**URL:** https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431
**Category:** Questions about Thunkable X
**Created:** [August 12, 2021, 8:58pm UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431 "2021-08-12T20:58:35Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 12, 2021, 8:58pm UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/1 "2021-08-12T20:58:35Z")

</div>

hi,  
i am trying to show a progress bar in my app… i have sprites showing the various stages of the progress bar…but when i show the sprite in the stage/canvas, it appears as very small…  
i used the SET sprite’s HEIGHT block and SET sprite’s WIDTH block, but still the size is not changing …please help

is it impossible to fill the entire canvas with the sprite?..when i try to set sprite’s height and width to the height and width of the canvas, its not even visible!..what should i do to fill the canvas with the sprite?

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/7/27bb1d4610b2d9c2a07ba3c3d2d83c2326b201a1.png)  
@tatiang @muneer

---

<div class="post-metadata">

### Author: ![Dean\_Artis](https://avatars.discourse-cdn.com/v4/letter/d/a8b319/32.png) [@Dean\_Artis](https://community.thunkable.com/u/Dean_Artis)
#### Post date: [August 12, 2021, 11:20pm UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/2 "2021-08-12T23:20:51Z")

</div>

Show your blocks.

---

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 12, 2021, 11:44pm UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/3 "2021-08-12T23:44:54Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/7/27bb1d4610b2d9c2a07ba3c3d2d83c2326b201a1.png)

---

<div class="post-metadata">

### Author: ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)
#### Post date: [August 13, 2021, 7:41am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/4 "2021-08-13T07:41:14Z")

</div>

@sumeshoouh the logic there looks ok - but when are you **calling** your `FixCanvas` function?

If it’s for a progress bar is there some event in your game that happens and updates the progress?

---

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 13, 2021, 7:46am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/5 "2021-08-13T07:46:01Z")

</div>

yes @domhnallohanlon , i am updating the progress bar with timer countdown…  
but before that, i am first trying to show it in the canvas…The FixCanvas function is being called in Screen-Opens-event…the canvas is only in a small portion of the top part of the screen…canvas is not filling the entire screen as shown in available tutorials …but when i try to show a sprite its not visible…  
the variables cxRegress, cyRegress are calculated by getting device-width and then calculating the percentage of width and height of the column, containing the canvas

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 13, 2021, 8:13am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/6 "2021-08-13T08:13:55Z")

</div>

If this is the first attempt to use sprites, i advise to start with a canvas that is the size of the screen and provide x and y coordinates that you know are in the visible area of the screen to see your code in action.

Having done this successfully, start to implement your requires code step by step to know where it fails,

You are showing only a function which is part of your code and design which makes it difficult to suggest anything at the moment.

---

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 13, 2021, 8:17am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/7 "2021-08-13T08:17:11Z")

</div>

ok @muneer , i will create a project and will post its link

---

<div class="post-metadata">

### Author: ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)
#### Post date: [August 13, 2021, 8:22am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/8 "2021-08-13T08:22:44Z")

</div>

@sumeshoouh not sure if you are required to use the canvas for this, but if not there’s a progress bar tutorial that might be useful:

> [@How to create a progress bar](https://community.thunkable.com/t/how-to-create-a-progress-bar/115625):
>
> Overview At the end of this tutorial you will be able to create a custom progress bar for your apps, just like the thin yellow bar that you can see scrolling across the bottom of the screen here. recycle Remix this app If you want jump straight in and get a copy of this project yourself then just click on this [remix link](https://x.thunkable.com/copy/7b0ea9fa53caf9bd1c3fe7ec3540a970) 1. Increment and Show Percent For this example the CounterLabel.Text starts at 0 and increases with each button press. To set the width of the ProgressLab…

---

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 13, 2021, 8:27am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/9 "2021-08-13T08:27:28Z")

</div>

this is a great idea…thanks @domhnallohanlon …but in my progress bar i have logo-picture as the moving tip of the progress bar…its like pointer in a slider…thats why i am left with only option to use canvas…i will create a project and post the link here…

---

<div class="post-metadata">

### Author: ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)
#### Post date: [August 13, 2021, 8:55am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/10 "2021-08-13T08:55:58Z")

</div>

> [@sumeshoouh](#):
>
> in my progress bar i have logo-picture as the moving tip

Two points on this;

1. Is this a “nice to have” feature or a “have to have” feature?

2. Are you using the latest DnD version of Thunkable?

---

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 13, 2021, 10:01am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/11 "2021-08-13T10:01:21Z")

</div>

hi @domhnallohanlon,

1. unfortunately, its a “have to have” feature…(out of my control…)
2. no i am using the old version

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 13, 2021, 11:28am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/12 "2021-08-13T11:28:42Z")

</div>

Check this progress demo with an image and without canvas.  
[https://x.thunkable.com/projectPage/6116539221a7b8001144bf04](https://x.thunkable.com/projectPage/6116539221a7b8001144bf04)

---

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 13, 2021, 11:39am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/13 "2021-08-13T11:39:30Z")

</div>

thanks @muneer .  
thanks @domhnallohanlon  
thanks @Dean_Artis

---

<div class="post-metadata">

### Author: ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)
#### Post date: [August 13, 2021, 7:04pm UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/14 "2021-08-13T19:04:39Z")

</div>

@sumeshoouh did @muneer’s example solve this for you?

If so can you mark as “solved” please?

Thanks!

---

<div class="post-metadata">

### Author: ![sumeshoouh](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@sumeshoouh](https://community.thunkable.com/u/sumeshoouh)
#### Post date: [August 14, 2021, 12:18am UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/15 "2021-08-14T00:18:20Z")

</div>

yes, sure…  
thanks a lot

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:17pm UTC](https://community.thunkable.com/t/how-do-we-programmatically-set-sprite-size/1446431/16 "2024-11-08T13:17:28Z")

</div>


