Jump to content

Help in creating Python gui


Recommended Posts

Hey guys, i started trying to learn python, i have a problem i created a gui of loot filter, i created some buttons and images

scrollbar works too, i only have the issue that nothing is clickable, i spent many hours (many) trying to fix the issue.

i know my code is really bad.. i'm just trying to learn this, and its my first time.

 

i'd be happy if someone can help me fixing the issue so i actually understand why nothing is clickable:

 

LAXfjkz.gif

 

here is my file: https://pastebin.com/hQkQQa7f

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Hi.

As far as i see, the problem can be in the lootingsystem.py uiscript. this issue is one of the possible reasons, and comming from ui element's flag, when you add the 'attach' word to 'style' tag.

If you have that 'attach' word in any of button's 'style' tag, remove it.

But for sure, you can paste the lootingsystem.py's content here too.

  • Good 1

All wolves are gray in the dark.

Link to comment
Share on other sites

import uiScriptLocale

PATTERN_PATH			= "d:/ymir work/ui/pattern/"
ROOT_PATH				= "d:/ymir work/ui/game/looting/"

WINDOW_WIDTH			= 316
WINDOW_HEIGHT			= 494

PATTERN_WINDOW_WIDTH	= 294
PATTERN_WINDOW_HEIGHT	= 390

PATTERN_X_COUNT = (PATTERN_WINDOW_WIDTH - 32) / 16
PATTERN_Y_COUNT = (PATTERN_WINDOW_HEIGHT - 32) / 16


window = {
	"name" : "LootingSystem",
	"style" : ("movable", "float",),
	
	"x" : SCREEN_WIDTH / 2 - WINDOW_WIDTH / 2,
	"y" : SCREEN_HEIGHT / 2 - WINDOW_HEIGHT / 2,
	
	"width" : WINDOW_WIDTH,
	"height" : WINDOW_HEIGHT,
	
	"children" :
	(
		{
			"name" : "board",
			"type" : "board_with_titlebar",
			"style" : ("attach",),
			
			"x" : 0,
			"y" : 0,
			
			"width" : WINDOW_WIDTH,
			"height" : WINDOW_HEIGHT,
			
			"title" : uiScriptLocale.LOOTING_SYSTEM_TITLE,
			
			"children" :
			(
				## base pattern
				{
					"name" : "base_pattern",
					"type" : "window",
					"style" : ("attach", "ltr",),
					
					"x" : 10,
					"y" : 32,
					"width" : PATTERN_WINDOW_WIDTH,
					"height" :PATTERN_WINDOW_HEIGHT,
					
					"children" :
					(
						## LeftTop 1
						{
							"name" : "pattern_left_top_img",
							"type" : "image",
							"style" : ("ltr",),
							
							"x" : 0,
							"y" : 0,
							"image" : PATTERN_PATH + "border_A_left_top.tga",
						},
						## RightTop 2
						{
							"name" : "pattern_right_top_img",
							"type" : "image",
							"style" : ("ltr",),
							
							"x" : PATTERN_WINDOW_WIDTH - 16,
							"y" : 0,
							"image" : PATTERN_PATH + "border_A_right_top.tga",
						},
						## LeftBottom 3
						{
							"name" : "pattern_left_bottom_img",
							"type" : "image",
							"style" : ("ltr",),
							
							"x" : 0,
							"y" : PATTERN_WINDOW_HEIGHT - 16,
							"image" : PATTERN_PATH + "border_A_left_bottom.tga",
						},
						## RightBottom 4
						{
							"name" : "pattern_right_bottom_img",
							"type" : "image",
							"style" : ("ltr",),
							
							"x" : PATTERN_WINDOW_WIDTH - 16,
							"y" : PATTERN_WINDOW_HEIGHT - 16,
							"image" : PATTERN_PATH + "border_A_right_bottom.tga",
						},
						## topcenterImg 5
						{
							"name" : "pattern_top_cetner_img",
							"type" : "expanded_image",
							"style" : ("ltr",),
							
							"x" : 16,
							"y" : 0,
							"image" : PATTERN_PATH + "border_A_top.tga",
							"rect" : (0.0, 0.0, PATTERN_X_COUNT, 0),
						},
						## leftcenterImg 6
						{
							"name" : "pattern_left_center_img",
							"type" : "expanded_image",
							"style" : ("ltr",),
							
							"x" : 0,
							"y" : 16,
							"image" : PATTERN_PATH + "border_A_left.tga",
							"rect" : (0.0, 0.0, 0, PATTERN_Y_COUNT),
						},
						## rightcenterImg 7
						{
							"name" : "pattern_right_center_img",
							"type" : "expanded_image",
							"style" : ("ltr",),
							
							"x" : PATTERN_WINDOW_WIDTH - 16,
							"y" : 16,
							"image" : PATTERN_PATH + "border_A_right.tga",
							"rect" : (0.0, 0.0, 0, PATTERN_Y_COUNT),
						},
						## bottomcenterImg 8
						{
							"name" : "pattern_bottom_center_img",
							"type" : "expanded_image",
							"style" : ("ltr",),
							
							"x" : 16,
							"y" : PATTERN_WINDOW_HEIGHT - 16,
							"image" : PATTERN_PATH + "border_A_bottom.tga",
							"rect" : (0.0, 0.0, PATTERN_X_COUNT, 0),
						},
						## centerImg
						{
							"name" : "pattern_center_img",
							"type" : "expanded_image",
							"style" : ("ltr",),
							
							"x" : 16,
							"y" : 16,
							"image" : PATTERN_PATH + "border_A_center.tga",
							"rect" : (0.0, 0.0, PATTERN_X_COUNT, PATTERN_Y_COUNT),
						},
					),
				},
				
				## object in pattern window
				{
					"name" : "object_area_window",
					"type" : "window",
					"style" : ("attach",),
					
					"x" : 10+5,
					"y" : 32+5,
					"width"		: 270,
					"height"	: 380,
				},

				## scroll bar
				{
					"name" : "scroll_bar",
					"type" : "scrollbar",

					"x" : 286,
					"y" : 36,
					"size" : 380,
				},
				
				## Init Button
				{
					"name" : "init_button",
					"type" : "button",

					"x" : 11,
					"y" : 428,

					"default_image" : "d:/ymir work/ui/public/large_button_01.sub",
					"over_image" : "d:/ymir work/ui/public/large_button_02.sub",
					"down_image" : "d:/ymir work/ui/public/large_button_03.sub",

					"text" : uiScriptLocale.LOOTING_SYSTEM_INIT,
				},
				
				## Save Button
				{
					"name" : "save_button",
					"type" : "button",

					"x" : 217,
					"y" : 428,

					"default_image" : "d:/ymir work/ui/public/large_button_01.sub",
					"over_image" : "d:/ymir work/ui/public/large_button_02.sub",
					"down_image" : "d:/ymir work/ui/public/large_button_03.sub",

					"text" : uiScriptLocale.LOOTING_SYSTEM_SAVE,
				},

				## message
				{
					"name" : "message_window", "type" : "window", "x" : 18, "y" : 457, "width" : 279, "height" : 18, "style" : ("attach",),
					"children" :
					(
						{ "name" : "message_bg",	"type" : "image", "style" : ("ltr", "attach", ), "x" : 0, "y" : 0, "image" : ROOT_PATH + "message_bg.sub", },
						{ "name" : "message_text",	"type" : "text", "x":0, "y":0, "text": "", "all_align" : "center" },
					),	
				},
			),
		},
	),	
}

 

Thanks buddy i added my uiscript file 😄 

But i already tested that, now atleast the window movable  issue is fixed, but i cant click on anything still.

 

I personally think its a issue of parent, but i couldnt fix it..

Link to comment
Share on other sites

@Shang to be exactly, the not clickable problem appeared after i did some changes to the general structure of the file, in order to create a scrollbar with window clipping i made a listbox where all the item get appended and after that, nothing went "non clickable"

 

i would love if someone can take a quick look in anydesk. 

 

kind regards 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.