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

  • Home
  • SEARCH
  • 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 6170605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:04:02+00:00 2026-05-23T23:04:02+00:00

How would I be able to change the window’s opacity from a slider? I

  • 0

How would I be able to change the window’s opacity from a slider?

I made the code, but I’m stuck on where to go from here.

#!/usr/bin/python

import gtk

class app(gtk.Window):

  def __init__(self):
    super(app, self).__init__()

    self.set_position(gtk.WIN_POS_CENTER)
    self.set_title("Opacity Slider Test")
    self.set_decorated(True)
    self.set_has_frame(False)
    self.set_resizable(False)
    self.set_default_size(320, 50)
    self.connect("destroy", gtk.main_quit)
    vbox = gtk.VBox(spacing=4)
    hbox = gtk.HBox(spacing=4)

    scale = gtk.HScale()
    scale.set_range(0, 100)
    scale.set_size_request(320, 25)
    scale.connect("value-changed", self.opacity_slider)

    vbox.add(scale)
    self.add(vbox)
    self.show_all()

  def opacity_slider(self, w):


app()
gtk.main()
  • 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-05-23T23:04:03+00:00Added an answer on May 23, 2026 at 11:04 pm
    #!/usr/bin/python
    
    import gtk
    
    class app(gtk.Window):
    
      def __init__(self):
        super(app, self).__init__()
    
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_title("Opacity Slider Test")
        self.set_decorated(True)
        self.set_has_frame(False)
        self.set_resizable(False)
        self.set_default_size(320, 50)
        self.connect("destroy", gtk.main_quit)
        vbox = gtk.VBox(spacing=4)
        hbox = gtk.HBox(spacing=4)
    
        scale = gtk.HScale()
        scale.set_range(0, 100)
        scale.set_size_request(320, 25)
        scale.set_value(100)
        scale.connect("value-changed", self.opacity_slider)
    
        vbox.add(scale)
    
        opacity = gtk.Label()
        opacity.set_label("Change Opacity")
        vbox.add(opacity)
    
        self.add(vbox)
        self.show_all()
    
      def opacity_slider(self, w):
        self.set_opacity(w.get_value()/100.0)
    
    app()
    gtk.main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to be able to change the title of the Command window
I would like to be able to hide another application's window from the taskbar,
I would like to be able to change the active pane of an accordion
I would like to be able to change the locale in my Swing application
I would like to be able to change the size of text in a
I would like to be able to change the printer properties without bringing up
I would like to see how this example of existing code would be able
The question I have is how I would be able to change the value
When I would be able to write : <asp:TextBox id=Input runat=server/> <asp:Button onclick=<% Input.Text='my
I would like to find out where I would be able to find the

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.