Skocz do zawartości
Masz już aplikację Sharegon?

Odkryj wszystkie możliwości. Dowiedz się więcej

Sharegon.pl

Zainstaluj aplikację Sharegon i korzystaj z powiadomień push oraz licznika nowych aktywności bezpośrednio z ekranu głównego.

Aby zainstalować tę aplikację na iOS i iPadOS.
  1. Tap the Share icon in Safari
  2. Przewiń menu i stuknij Dodaj do ekranu początkowego.
  3. Stuknij Dodaj w prawym górnym rogu.
Zainstaluj aplikację Sharegon na Androidzie
  1. Otwórz Sklep Google Play na swoim smarfonie.
  2. Wyszukaj „Sharegon” w pasku wyszukiwania.
  3. Stuknij „Zainstaluj”, aby pobrać aplikację.

Problem przy dodaniu tekstu "kanał" w pliku locale_game.txt - TypeError: 'an integer is required'

Nowy

Featured Replies

Opublikowano

witam, zmieniłem kod na:

def NotifyChannelState(self, addrKey, state):
		if addrKey == 1:
			if state != 3:
				self.Channel1Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel1Button.SetText(localeInfo.CHANNEL + " 1 (" + STATE_DICT[state] + ")")
		if addrKey == 2:
			if state != 3:
				self.Channel2Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel2Button.SetText(localeInfo.CHANNEL + " 2 (" + STATE_DICT[state] + ")")
		if addrKey == 3:
			if state != 3:
				self.Channel3Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel4Button.SetText(localeInfo.CHANNEL + " 3 (" + STATE_DICT[state] + ")")
		if addrKey == 4:
			if state != 3:
				self.Channel4Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel4Button.SetText(localeInfo.CHANNEL + " 4 (" + STATE_DICT[state] + ")")
{
					"name": "Channel1Button",
					"type": "radio_button",
					"x": 10,
					"y": 10,
					"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",
					"color": 4294281095L, 
                    "text": ".....",
				},

Lecz wyświetla "....." a powinno: "Kanał 1 (NORM)"

Logi z syser:

0315 17:41:00530 :: mouseModule:357: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
0315 17:41:00530 :: Traceback (most recent call last):
0315 17:41:00530 ::   File "mouseModule.py", line 357, in Update
0315 17:41:00530 :: TypeError
0315 17:41:00530 :: : 
0315 17:41:00530 :: an integer is required
0315 17:41:00530 :: 
0315 17:41:01393 :: Traceback (most recent call last):
0315 17:41:01393 ::   File "mouseModule.py", line 357, in Update
0315 17:41:01393 :: TypeError
0315 17:41:01393 :: : 
0315 17:41:01393 :: an integer is required
0315 17:41:01393 :: 
0315 17:41:01661 :: Traceback (most recent call last):
0315 17:41:01661 ::   File "mouseModule.py", line 357, in Update
0315 17:41:01661 :: TypeError
0315 17:41:01661 :: : 
0315 17:41:01661 :: an integer is required
0315 17:41:01661 :: 
0315 17:41:01945 :: Traceback (most recent call last):
0315 17:41:01945 ::   File "mouseModule.py", line 357, in Update
0315 17:41:01945 :: TypeError
0315 17:41:01945 :: : 
0315 17:41:01945 :: an integer is required
0315 17:41:01945 :: 

Co robię źle?

Opublikowano

Widze literówke


		if addrKey == 3:
			if state != 3:
				self.Channel3Button.SetFontColor(0.0, 1.0, 0.0)
			# 	z channel4button na channel 3 button	
				self.Channel3Button.SetText(localeInfo.CHANNEL + " 3 (" + STATE_DICT[state] + ")")	


Widzę też

TypeError: an integer is required

Spróbuj zamienić kolor na wartość szesnastkową, np.

def NotifyChannelState(self, addrKey, state):
    GREEN_COLOR = 0xff00ff00 

    if addrKey == 1:
        if state != 3:
            self.Channel1Button.SetFontColor(GREEN_COLOR)
        self.Channel1Button.SetText(localeInfo.CHANNEL + " 1 (" + STATE_DICT[state] + ")")

Daj znać czy działa

Opublikowano
  • Autor

Zrobiłem jak mówiłeś i teraz takie logi:

0315 18:34:00539 :: mouseModule:357: RuntimeWarning: tp_compare didn't return -1 or -2 for exception

0315 18:34:00540 :: Traceback (most recent call last):

0315 18:34:00540 ::   File "mouseModule.py", line 357, in Update

0315 18:34:00540 :: TypeError
0315 18:34:00540 :: : 
0315 18:34:00540 :: an integer is required
0315 18:34:00540 :: 

0315 18:34:01517 :: Traceback (most recent call last):

0315 18:34:01517 ::   File "mouseModule.py", line 357, in Update

0315 18:34:01518 :: TypeError
0315 18:34:01518 :: : 
0315 18:34:01518 :: an integer is required
0315 18:34:01518 :: 

0315 18:34:01909 :: Traceback (most recent call last):

0315 18:34:01909 ::   File "mouseModule.py", line 357, in Update

0315 18:34:01909 :: TypeError
0315 18:34:01909 :: : 
0315 18:34:01909 :: an integer is required
0315 18:34:01909 :: 

0315 18:34:02533 :: Traceback (most recent call last):

0315 18:34:02533 ::   File "mouseModule.py", line 357, in Update

0315 18:34:02533 :: TypeError
0315 18:34:02533 :: : 
0315 18:34:02533 :: an integer is required
0315 18:34:02533 :: 
Opublikowano
def NotifyChannelState(self, addrKey, state):
		if addrKey == 1:
			if state != 3:
				self.Channel1Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel1Button.SetText("Kanał 1 ({})".format(STATE_DICT[state]))
		if addrKey == 2:
			if state != 3:
				self.Channel2Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel2Button.SetText("Kanał 2 ({})".format(STATE_DICT[state]))
		if addrKey == 3:
			if state != 3:
				self.Channel3Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel3Button.SetText("Kanał 3 ({})".format(STATE_DICT[state]))
		if addrKey == 4:
			if state != 3:
				self.Channel4Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel4Button.SetText("Kanał 4 ({})".format(STATE_DICT[state]))

chyba tak

Opublikowano
  • Autor
18 minut temu, _daha_0 napisał(a):
def NotifyChannelState(self, addrKey, state):
		if addrKey == 1:
			if state != 3:
				self.Channel1Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel1Button.SetText("Kanał 1 ({})".format(STATE_DICT[state]))
		if addrKey == 2:
			if state != 3:
				self.Channel2Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel2Button.SetText("Kanał 2 ({})".format(STATE_DICT[state]))
		if addrKey == 3:
			if state != 3:
				self.Channel3Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel3Button.SetText("Kanał 3 ({})".format(STATE_DICT[state]))
		if addrKey == 4:
			if state != 3:
				self.Channel4Button.SetFontColor(0.0, 1.0, 0.0)
			self.Channel4Button.SetText("Kanał 4 ({})".format(STATE_DICT[state]))

chyba tak

To teraz takie coś wywala: 0315 20:00:00885 :: mouseModule:357: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
0315 20:00:00885 :: Traceback (most recent call last):
0315 20:00:00885 :: File "mouseModule.py", line 357, in Update
0315 20:00:00885 :: TypeError
0315 20:00:00885 :: :
0315 20:00:00885 :: an integer is required
0315 20:00:00885 ::

a w cliencie dalej "...."

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Konto

Nawigacja

Skonfiguruj powiadomienia push w przeglądarce.

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Wybierz Uprawnienia → Powiadomienia.
  3. Dostosuj swoje preferencje.
Chrome (Desktop)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje preferencje.