How to Change Transparency in Pygame || Transparent and Translucent Images and Objects in Pygame

Поделиться
HTML-код
  • Опубликовано: 1 янв 2025

Комментарии •

  • @rethanon
    @rethanon Год назад +2

    Nice explanation dude!

    • @lemastertech
      @lemastertech  Год назад

      Thanks Dale!! Been wanting to do a tutorial on this for a while but didn’t want it to get too long! I wasn’t sure if setting up a brand new PyGame project needed to be a part of this but the total video stayed under 15 minutes so I left it in! Hopefully not too long :)

  • @willwillcode7568
    @willwillcode7568 Год назад +1

    This is an interesting je for sure. It’s one thing with shapes but with images. This is really cool.😀

    • @lemastertech
      @lemastertech  Год назад

      Thanks Will! It’s super useful for making animated scenes where things may want to fade in or fade out too!

  • @pogmij
    @pogmij Год назад +2

    thanks man, appreciate that

  • @frazebean5117
    @frazebean5117 Год назад +1

    thanks for the video!

    • @lemastertech
      @lemastertech  Год назад +1

      You’re very welcome thanks for watching!!

  • @flioink
    @flioink Год назад +1

    So if you're drawing a shape in pygame
    you gotta add it to a surface that has a transparency attribute(if you want transparency),
    but loaded images get a transparency automatically.
    Makes sense😎

    • @lemastertech
      @lemastertech  Год назад +1

      yes sir! I think there's also a way to 'convert' a shape to a surface so it can set transparency but in my mind that's more tedious than this method!

  • @EstefaniGil-be6kc
    @EstefaniGil-be6kc 5 месяцев назад +1

    Yo uso varios tamaños de pantallas pero al cambiarla la transparencia se duplica de formas raras.. me podes ayudar con una class que solucione ese problema.. gracias 😊

    • @lemastertech
      @lemastertech  4 месяца назад

      Lo siento mi español es horrible pero si puedo ayudarte que chevere!

  • @knknngor2350
    @knknngor2350 Год назад

    Yo, is there a way to change the transparency of the window itself, while leaving the objects I draw onto it opaque? I've looked at pygame docs and there is a way to set alpha values for colours, but if I try to use the colour as the fill colour for my background, it remains black, when I want to be able to see other windows under it.

    • @lemastertech
      @lemastertech  Год назад

      Hi - so the pygame window will always have a base layer of 100% solid opaque where you won't be able to like see your desktop behind it - but you can fill the screen with a surface or an image that has a semi-transparent color with an alpha setting, so you can achieve pretty much any color you want, but the window itself can't really do semi-transparent! Hope this helps!

    • @knknngor2350
      @knknngor2350 Год назад

      @@user-oi9gi7kl2p I am on windows 10, and no, it does not have to be done with pygame, I am only using pygame because I am only familiar with python. I can use other languages, it will just be harder as I do not know how to code on them

    • @knknngor2350
      @knknngor2350 Год назад

      @@user-oi9gi7kl2p What is it?

  • @gualdim
    @gualdim Год назад +1

    👍🏻

  • @amourabidi492
    @amourabidi492 Год назад +1

    can you just make a 1 minute video showing me what I want to see Im too dumb to understand anything else
    >:V

    • @lemastertech
      @lemastertech  Год назад

      Haha I could I suppose - what specifically did you want to see??

    • @amourabidi492
      @amourabidi492 Год назад

      @@lemastertech excuse me for my rage, I was trying to code in python for the first time and fill the screen with a 1% opacity rectangle so my moving rectangle would have a trail.
      I have stopped coding in python :^)