TypeError: __call__() got an unexpected keyword argument.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
fuwafactory
Newbie
Posts: 8
Joined: Fri Apr 10, 2015 10:51 pm
Projects: The Day After Tomorrow
Organization: Fuwa Factory.
Tumblr: fuwafactory
Contact:

TypeError: __call__() got an unexpected keyword argument.

#1 Post by fuwafactory »

I'm back with another problem.
I was messing around in the options.rpy file and adding images to the main menu buttons when I booted up the game and this happened:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While executing init code:
  File "game/options.rpy", line 10, in script
    init -1 python hide:
  File "game/options.rpy", line 66, in <module>
    mm_root = "#FFFFFF",
TypeError: __call__() got an unexpected keyword argument 'mm_root'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/options.rpy", line 10, in script
    init -1 python hide:
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\ast.py", line 785, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/options.rpy", line 66, in <module>
    mm_root = "#FFFFFF",
TypeError: __call__() got an unexpected keyword argument 'mm_root'

Windows-post2008Server-6.2.9200
Ren'Py 6.18.2.729
The_Day_After_Tomorrow 0.0
I'm gonna guess that this has to do with something about the newly placed images.
But what's weird is that since my main menu doesn't currently have an image, it's just '#FFFFFF', yet it's glitching up anyway.

If anyone has an answer to this, I'd be grateful!

UPDATE: This is a pretty serious problem. I can't make any more progress other than plot with the game without testing which is a huge burden so quick replies are appreciated!

nintendotoad
Regular
Posts: 42
Joined: Sat Mar 31, 2012 2:56 pm
Location: projectexist.net
Contact:

Re: TypeError: __call__() got an unexpected keyword argument

#2 Post by nintendotoad »

mm_root should be a member of the theme declaration.

Could you copy-paste your theme definition? It should look something likethis

Code: Select all

    theme.threeD(#or theme.roundrect, or theme.a_white_tulip, or theme.tv, or.......
        # Color scheme: Colorblind
        widget = "#898989",

        widget_hover = "#464646",

        widget_text = "#CCCCCC",

        widget_selected = "#F2F2F2",

        disabled = "#898989",

        disabled_text = "#666666",

        label = "#c2c2c2",

        frame = "#252525",

        ## Someone is having trouble here
        mm_root = "drops/menu.png",

        gm_root = "#393939",

        rounded_window = False

        ## And we're done with the theme. The theme will customize
        ## various styles, so if we want to change them, we should
        ## do so below.            
        )

User avatar
fuwafactory
Newbie
Posts: 8
Joined: Fri Apr 10, 2015 10:51 pm
Projects: The Day After Tomorrow
Organization: Fuwa Factory.
Tumblr: fuwafactory
Contact:

Re: TypeError: __call__() got an unexpected keyword argument

#3 Post by fuwafactory »

Okay, so I found out that in the first line of the theme code you posted I deleted my theme name for some reason so it resulted in that error.
After filling it in with my selected theme I got this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While executing init code:
  File "game/options.rpy", line 10, in script
    init -1 python hide:
  File "game/options.rpy", line 85, in <module>
    rounded_window = False
  File "renpy/common/00themes.rpy", line 356, in main
    frame)
  File "renpy/common/00themes.rpy", line 119, in frames
    style.frame.background = Box(frame, less_rounded)
  File "renpy/common/00themes.rpy", line 105, in Box
    return Frame(theme.OneOrTwoColor(file_prefix + "_box.png", color), 12, 12)
  File "renpy/common/00themes.rpy", line 99, in OneOrTwoColor
    return im.Twocolor(image, color, color)
Exception: Color string must be 3, 4, 6, or 8 hex digits long.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/options.rpy", line 10, in script
    init -1 python hide:
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\ast.py", line 785, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/options.rpy", line 85, in <module>
    rounded_window = False
  File "renpy/common/00themes.rpy", line 356, in main
    frame)
  File "renpy/common/00themes.rpy", line 119, in frames
    style.frame.background = Box(frame, less_rounded)
  File "renpy/common/00themes.rpy", line 105, in Box
    return Frame(theme.OneOrTwoColor(file_prefix + "_box.png", color), 12, 12)
  File "renpy/common/00themes.rpy", line 99, in OneOrTwoColor
    return im.Twocolor(image, color, color)
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\display\im.py", line 944, in __init__
    white = renpy.easy.color(white)
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\easy.py", line 65, in color
    raise Exception("Color string must be 3, 4, 6, or 8 hex digits long.")
Exception: Color string must be 3, 4, 6, or 8 hex digits long.

Windows-post2008Server-6.2.9200
Ren'Py 6.18.2.729
The_Day_After_Tomorrow 0.0
And I have no clue why this happened.
Also, here's my theme code if it will help anything.

Code: Select all

    theme.regal(

        ## The color of an idle widget face.
        widget = "images/button_idle.png",

        ## The color of a focused widget face.
        widget_hover = "images/button_idle.png",

        ## The color of the text in a widget.
        widget_text = "#FFFFFF",

        ## The color of the text in a selected widget. (For
        ## example, the current value of a preference.)
        widget_selected = "images/button_idle.png",

        ## The color of a disabled widget face.
        disabled = "images/button_idle.png",

        ## The color of disabled widget text.
        disabled_text = "#969CA1",

        ## The color of informational labels.
        label = "#ADC9E0",

        frame = "images/frame.png",

        ## The background of the main menu. This can be a color
        ## beginning with '#', or an image filename. The latter
        ## should take up the full height and width of the screen.
        mm_root = "#FFFFFF",

        ## The background of the game menu. This can be a color
        ## beginning with '#', or an image filename. The latter
        ## should take up the full height and width of the screen.
        
        #gm_root = "gm_bg.jpg", #Game-menu background
        
        ## Music that is played while the user is at the main menu.

        #config.main_menu_music = "main.mp3"
        
        ## Music that is played while the user is at the game menu.

        #config.main_menu_music = "game.mp3"

        ## If this is True, the in-game window is rounded. If False,
        ## the in-game window is square.

        rounded_window = False

        ## And we're done with the theme. The theme will customize
        ## various styles, so if we want to change them, we should
        ## do so below.
        )

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: TypeError: __call__() got an unexpected keyword argument

#4 Post by philat »

Try not to delete comments in the original files unless you're really sure you don't need them.

Code: Select all

        ## The color of a frame containing widgets.
        frame = "#ADB9CC",
This is a snippet from the renpy-generated options.rpy. As you can see, it specifies a color. You're trying to make it an image, but Frame() needs more than just the file name, so it wouldn't make sense that this snippet of code could supply just the file name and work. http://www.renpy.org/doc/html/displayables.html#Frame

User avatar
fuwafactory
Newbie
Posts: 8
Joined: Fri Apr 10, 2015 10:51 pm
Projects: The Day After Tomorrow
Organization: Fuwa Factory.
Tumblr: fuwafactory
Contact:

Re: TypeError: __call__() got an unexpected keyword argument

#5 Post by fuwafactory »

I couldn't really get the image thing to work, so I changed the frame to #FFFFFF.
But then I got this error...

Code: Select all

I'm sorry, but an uncaught exception occurred.

While executing init code:
  File "game/options.rpy", line 10, in script
    init -1 python hide:
  File "game/options.rpy", line 85, in <module>
    rounded_window = False
  File "renpy/common/00themes.rpy", line 366, in main
    disabled_text)
  File "renpy/common/00themes.rpy", line 138, in buttons
    style.button.background = Box(widget, less_rounded)
  File "renpy/common/00themes.rpy", line 105, in Box
    return Frame(theme.OneOrTwoColor(file_prefix + "_box.png", color), 12, 12)
  File "renpy/common/00themes.rpy", line 99, in OneOrTwoColor
    return im.Twocolor(image, color, color)
Exception: Color string must be 3, 4, 6, or 8 hex digits long.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/options.rpy", line 10, in script
    init -1 python hide:
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\ast.py", line 785, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/options.rpy", line 85, in <module>
    rounded_window = False
  File "renpy/common/00themes.rpy", line 366, in main
    disabled_text)
  File "renpy/common/00themes.rpy", line 138, in buttons
    style.button.background = Box(widget, less_rounded)
  File "renpy/common/00themes.rpy", line 105, in Box
    return Frame(theme.OneOrTwoColor(file_prefix + "_box.png", color), 12, 12)
  File "renpy/common/00themes.rpy", line 99, in OneOrTwoColor
    return im.Twocolor(image, color, color)
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\display\im.py", line 944, in __init__
    white = renpy.easy.color(white)
  File "C:\Users\Lily\Desktop\Stuff\renpy_\renpy\easy.py", line 65, in color
    raise Exception("Color string must be 3, 4, 6, or 8 hex digits long.")
Exception: Color string must be 3, 4, 6, or 8 hex digits long.

Windows-post2008Server-6.2.9200
Ren'Py 6.18.2.729
The_Day_After_Tomorrow 0.0

ForklessAnon
Regular
Posts: 49
Joined: Fri Sep 06, 2013 1:13 am
Contact:

Re: TypeError: __call__() got an unexpected keyword argument

#6 Post by ForklessAnon »

Code: Select all

## The color of an idle widget face.
        widget = "images/button_idle.png",

        ## The color of a focused widget face.
        widget_hover = "images/button_idle.png",

        ## The color of the text in a widget.
        widget_text = "#FFFFFF",

        ## The color of the text in a selected widget. (For
        ## example, the current value of a preference.)
        widget_selected = "images/button_idle.png",

        ## The color of a disabled widget face.
        disabled = "images/button_idle.png",

        ## The color of disabled widget text.
        disabled_text = "#969CA1",

        ## The color of informational labels.
        label = "#ADC9E0",

        frame = "images/frame.png",
These values must be hexadecimal colors. theme.regal is a roundrect_based_theme which is a default theme that when called, sets the style options according to the color modifier values you give it.

A renpy theme is just a fancy and convenient wrapper for setting up the game's style options. If you are making a custom theme that will only be used in one specific way, there isn't a need to make an @theme function, you should just set your desired style values for the game. Using the @theme decorator is good if you wish to share a dynamic theme you made with others, or even allow the user to pick their own parameters for the game's theme.
Have a look at the /renpy/common/00themes.rpy file. There are a few examples of how you can setup a theme.

1) If you want to just use an existing theme with default values, just call theme.regal (or whatever theme you wish to copy from) with the desired colors. You can find the default themes near line 420 (blaze it :P)

2) If you want to make a custom static theme, have a look at the ancient theme on line 429. All it takes is a call to theme.ancient() and it sets up all the hardcoded style options for you.

3) If you want to make a custom dynamic theme, have a look at line 745 and onward. That is the a_white_tulip theme. It's a bit more verbose and has a lot more customization to the style options than the default roundrect themes.

4) If you just want to customize an existing theme beyond the color options, call the theme you want with the desired options (that will set the initial styles) then override any styles you wish. Note: there are a lot of style options that rely on the widget and widget_hover colors, so if you want to have a custom image for those, please look at the roundrect_based_theme for what uses those options.
Example: (the colors are random)

Code: Select all

theme.regal(

        ## The color of an idle widget face.
        widget = "#BCF431",

        ## The color of a focused widget face.
        widget_hover = "#47BF8C",

        ## The color of the text in a widget.
        widget_text = "#FFFFFF",

        ## The color of the text in a selected widget. (For
        ## example, the current value of a preference.)
        widget_selected = "88AABB",

        ## The color of a disabled widget face.
        disabled = "#446677",

        ## The color of disabled widget text.
        disabled_text = "#969CA1",

        ## The color of informational labels.
        label = "#ADC9E0",

         ## The color of a frame containing widgets.
        frame = "#ACB4FC"

        ## And we're done with the theme. The theme will customize
        ## various styles, so if we want to change them, we should
        ## do so below.
        )

#Then set any of the style options you wish to use.
style.frame.background = Box("images/frame.png", False)
I believe that covers most of what themes are for. Hope that helps.

User avatar
fuwafactory
Newbie
Posts: 8
Joined: Fri Apr 10, 2015 10:51 pm
Projects: The Day After Tomorrow
Organization: Fuwa Factory.
Tumblr: fuwafactory
Contact:

Re: TypeError: __call__() got an unexpected keyword argument

#7 Post by fuwafactory »

Thank you!
After messing around a bit more with your help, I managed to fix the error.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Andredron, Google [Bot], Imperf3kt