0
嗨,大家好我已经做了一个嘘声! 我做了一个微调和填充它,然后认为...我想改变形式的颜色从黑色到白色,所以我做了,但现在的微调不在那里,我不知道什么是我做的!好,我有种不,我想我有错了地方的代码,但我不知道在正确的地方是...... SOOOOO微调不会出现在窗体上
from bs4 import BeautifulSoup
from urllib import request
import sys, traceback
import re
import kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.spinner import Spinner
from kivy.base import runTouchApp
from kivy.uix.image import Image
from kivy.uix.widget import Widget
from kivy.lang import Builder
root = Builder.load_string('''
FloatLayout:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
# self here refers to the widget i.e FloatLayout
pos: self.pos
size: self.size''')
class MainApp(App):
def build(self):
#add drop down box filled with stations
spinner = Spinner(
# default value shown
text='Pick a Station',
values=('Appledore','Axminster','Bampton','Barnstaple','Bere Alston','Bideford','Bovey Tracey','Braunton','Bridgwater','Brixham','Buckfastleigh','Budleigh Salterton','Burnham on sea','Camels Head','Castle Cary','Chagford','Chard','Cheddar','Chulmleigh','Colyton','Combe Martin','Crediton','Crewkerne','Crownhill','Cullompton','Dartmouth','Dawlish','Exeter Danes Castle','Exeter Middlemoor','Exmouth','Frome','Glastonbury','Greenbank','Hartland','Hatherleigh','Holsworthy','Honiton','Ilfracombe','Ilminster','Ivybridge','Kingsbridge','Kingston','Lundy Island','Lynton','Martock','Minehead','Modbury','Moretonhampstead','Nether Stowey','Newton Abbot','North Tawton','Okehampton','Ottery St Mary','Paignton','Plympton','Plymstock','Porlock','Princetown','Salcombe','Seaton','Shepton Mallet','Sidmouth','Somerton','South Molton','Street','Taunton','Tavistock','Teignmouth','Tiverton','Topsham','Torquay','Torrington','Totnes','USAR','Wellington','Wells','Williton','Wincanton','Witheridge','Wiveliscombe','Woolacombe','Yelverton','Yeovil'),
# just for positioning in our example
size_hint=(None, None),
size=(100, 44),
pos_hint={'center_y': 0.8})
def show_selected_value(spinner, text):
print('The spinner', spinner, 'have text', text)
spinner.bind(text=show_selected_value)
runTouchApp(spinner)
return root
###########################
#load stations into a list
StationsString = "Appledore,Axminster,Bampton,Barnstaple,Bere Alston,Bideford,Bovey Tracey,Braunton,Bridgwater,Brixham,Buckfastleigh,Budleigh Salterton,Burnham on sea,Camels Head,Castle Cary,Chagford,Chard,Cheddar,Chulmleigh,Colyton,Combe Martin,Crediton,Crewkerne,Crownhill,Cullompton,Dartmouth,Dawlish,Exeter Danes Castle,Exeter Middlemoor,Exmouth,Frome,Glastonbury,Greenbank,Hartland,Hatherleigh,Holsworthy,Honiton,Ilfracombe,Ilminster,Ivybridge,Kingsbridge,Kingston,Lundy Island,Lynton,Martock,Minehead,Modbury,Moretonhampstead,Nether Stowey,Newton Abbot,North Tawton,Okehampton,Ottery St Mary,Paignton,Plympton,Plymstock,Porlock,Princetown,Salcombe,Seaton,Shepton Mallet,Sidmouth,Somerton,South Molton,Street,Taunton,Tavistock,Teignmouth,Tiverton,Topsham,Torquay,Torrington,Totnes,USAR,Wellington,Wells,Williton,Wincanton,Witheridge,Wiveliscombe,Woolacombe,Yelverton,Yeovil"
TheStation = StationsString.split(',')
if __name__ == '__main__':
MainApp().run()
###########################
#get info for incident
def FindIncident(sStation):
webpage = request.urlopen("http://www.dsfire.gov.uk/News/Newsdesk/IncidentsPast7days.cfm?siteCategoryId=3&T1ID=26&T2ID=35")#main page
soup = BeautifulSoup(webpage)
incidents = soup.find(id="CollapsiblePanel1") #gets todays incidents panel
Links = [] #create list call Links
for line in incidents.find_all('a'): #get all hyperlinks
Links.append("http://www.dsfire.gov.uk/News/Newsdesk/"+line.get('href')) #loads links into Links list while making them full links
n = 0
e = len(Links)
if e == n: #if no links available no need to continue
print("No Incidents Found Please Try Later")
sys.exit(0)
sFound = False
while n < e: #loop through links to find station
if sFound: #if the station has been found stop looking
sys.exit(0)
webpage = request.urlopen(Links[n]) #opens link in list)
soup = BeautifulSoup(webpage) #loads webpage
if soup.find_all('p', text=re.compile(r'{}'.format(sStation))) == []:#check if returned value is found
#do nothing leaving blank gave error
a = "1" #this is pointless but stops the error
else:
print(soup.find_all('p', text=re.compile(r'{}'.format(sStation)))) #output result
WebLink = Links[n]
sFound = True # to avoid un needed goes through the loop process
n=n+1 # moves counter to next in list
if not sFound: #after looping process if nothing has been found output nothing found
print("nothing found please try again later")
return;
###########################
那整个事情,到目前为止,我去的屁股按钮下的调整器调用FindIncident与在微调器中选择的工作站,按钮下方将是一个标签发送细节(而不是打印) 和IM希望有另一个按钮下,只有在出现如果站被发现打开网页中的网址。
这就是所有只是为了清楚大声笑我的问题是我在哪里把微调的代码是可见的?
感谢 RAIF
当我摆脱了代码的色彩方面的微调出现,或者在那里,但只要我改变颜色为白色它消失了。我甚至试过#define color 1 as black on blue curses.init_pair(1,curses.COLOR_BLACK,curses.COLOR_BLUE) stdscr.bkgd('',curses.color_pair(1))...想法请 – 2014-10-28 12:01:19