当前位置: 首页>>代码示例>>Python>>正文


Python JFrame.visible方法代码示例

本文整理汇总了Python中javax.swing.JFrame.visible方法的典型用法代码示例。如果您正苦于以下问题:Python JFrame.visible方法的具体用法?Python JFrame.visible怎么用?Python JFrame.visible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JFrame的用法示例。


在下文中一共展示了JFrame.visible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
 def handle(self):
     print 'connection from', self.client_address
     conn = self.request
     while 1:
         msg = conn.recv(20)
         if msg == "keymap":
             print "keymapping!"
             keymapFrame = JFrame('Key Mapping Configuration',
                            defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                            size = (300, 500)
                            )
             keyButton = JButton('Press any key in iPhone')
             keymapFrame.add(keyButton)
             keymapFrame.visible = True
             while 1:
                 recvKey = conn.recv(20)
                 keyButton.setLabel("%s?" % recvKey)
                 keyInput = raw_input()
                 keynum[recvKey] = keyInput
                 keyButton.setText('Press any key in iPhone')
                 if recvKey == "keymap":
                     keymapFrame.visible = False
                     break
         if msg == "quit()":
             conn.close()
             print self.client_address, 'disconnected'
             break
         print self.client_address, msg
开发者ID:jooneyp,项目名称:PhoyStick,代码行数:30,代码来源:keyListener.py

示例2: run

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
    def run(self):
        frame = JFrame('MainFrame', defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE)
        self.addButtons(frame.getContentPane())
        frame.size = (300, 175)
        frame.visible = 1 

        self.frame = frame
        self.startTimerTask()
开发者ID:ToroLiu,项目名称:gt_cg2scripts,代码行数:10,代码来源:BattleScripts.py

示例3: cachedBPROM

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
def cachedBPROM(genome, fileName, frame):
  """
  genome: Genome as a string.
  fileName: File to save the BPROM results in.
  swing: A JFrame or None.  If this is None then messages will be printed, if it isn't then
         they will also be put in a dialog box.

  return: Results of the BPROM prediction stored in a list of Promoter objects.

  If the file Specified by fileName already exists then this function simply parses the file
  already there.  Also, if a request is made to BPROM and nothing is returned, no file is
  created, the user is warned, and an empty list is returned.
  """
  offset = 25 if ".forward.bprom" in fileName else 50
  direction = "forward" if offset == 50 else "reverse"
    
  def getPromoters():
    input = open(fileName, "r")
    results = parseBPROM(input.read())
    input.close()
    return results

  if not os.path.isfile(fileName):
    results = urllib.urlopen("http://linux1.softberry.com/cgi-bin/programs/gfindb/bprom.pl",
                             urllib.urlencode({"DATA" : genome}))
    resultString = results.read()
    results.close()
    resultString = resultString[resultString.find("<pre>"):resultString.find("</pre>")]
    resultString = re.sub("<+.+>+", "", resultString).strip()
    if resultString:
      output = open(fileName, "w")
      output.write(resultString)
      output.close()
      return getPromoters()
    else:
      if frame:
        messageFrame = JFrame("BPROM Error",
                              defaultCloseOperation = WindowConstants.DISPOSE_ON_CLOSE)
        messageFrame.setLocation(frame.location().x + offset, frame.location().y + offset)
        messageFrame.contentPane.layout = GridBagLayout()
        constraints = GridBagConstraints()
        constraints.gridx, constraints.gridy = 0, 0
        constraints.gridwidth, constraints.gridheight = 1, 1
        constraints.fill = GridBagConstraints.BOTH
        constraints.weightx, constraints.weighty = 1, 1
        messageFrame.contentPane.add(JLabel("<html>The pipeline will continue to run but BPROM<br/>did not process the request for promoters on the<br/>" + direction + " strand.  Try again tomorrow.</html>"), constraints)
        constraints.gridx, constraints.gridy = 0, 1
        constraints.fill = GridBagConstraints.NONE
        constraints.weightx, constraints.weighty = 1, 1
        constraints.anchor = GridBagConstraints.LINE_END
        messageFrame.contentPane.add(JButton("Ok", actionPerformed = lambda e: messageFrame.dispose()), constraints)
        messageFrame.pack()
        messageFrame.visible = True
      print "BPROM Error:", "The pipeline will continue to run but BPROM did not process the request for promoters on the " + direction + " strand.  Try again tomorrow"
      return []
  else:
    return getPromoters()
开发者ID:pavithra03,项目名称:neofelis,代码行数:59,代码来源:promoters.py

示例4: run

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
def run(sketch):
    from javax.swing import JFrame
    from processing.core import PApplet

    class Main(PApplet):

        def __init__(self, sketch):
            self.sketch = sketch
            P5_set_instance(self)

        def setup(self):
            self.sketch['setup']()

        def draw(self):
            self.sketch['draw']()

        def mousePressed(self, evt):
            P5_register_mouse_event(evt)
            self.sketch['mousePressed']()

        def mouseReleased(self, evt):
            P5_register_mouse_event(evt)

        def mouseClicked(self, evt):
            P5_register_mouse_event(evt)
            self.sketch['mouseClicked']()

        def mouseEntered(self, evt):
            P5_register_mouse_event(evt)

        def mouseExited(self, evt):
            P5_register_mouse_event(evt)

        def mouseDragged(self, evt):
            P5_register_mouse_event(evt)
            self.sketch['mouseDragged'](evt)

        def mouseMoved(self, evt):
            P5_register_mouse_event(evt)
            self.sketch['mouseMoved'](evt)

        def getField(self, name):
            # rqd due to PApplet's using frameRate and frameRate(n) etc.
            return self.class.superclass.getDeclaredField(name).get(self)

    if __name__ == '__main__' or True:
        frame = JFrame(title="Processing",
            resizable=0,
            defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
        panel = Main(sketch)
        frame.add(panel)
        panel.init()
        while panel.defaultSize and not panel.finished:
            pass
        frame.pack()
        frame.visible = 1
开发者ID:gka,项目名称:processing.py,代码行数:58,代码来源:__init__.py

示例5: __init__

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
 def __init__(self):
     w = JFrame("Settler-o-matic", size = (120,680))
     w.setAlwaysOnTop(True)
     
     pause = JButton("Pause", actionPerformed = self.pause)
     w.add(pause, SOUTH)
     
     w.visible = True
     self.window = w
     self.pause = pause
开发者ID:Omaticala,项目名称:settler-o-matic,代码行数:12,代码来源:gui.py

示例6: run

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
    def run(self, query, print_urls = True, pr_weight =0.4, verbose = False):
        """this function basically runs a query""" 
        self.query = parse_query(query, self.reader)
        start_time = time.clock()
        
        self.n_show = 10
        
        if self.ah_flag is True:
            doc_ids, score, auth_ids, auth_score, hub_ids, hub_score = self.retrieve(verbose = verbose)
        elif self.pr_flag is True:
            doc_ids, score, pr_ids, pr = self.retrieve(pr_weight = pr_weight, verbose = verbose)
        else:
            doc_ids, score = self.retrieve(verbose = verbose)		

        end_time = time.clock()
        frame = JFrame('Ragav\'s Search Engine',
                        defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                        size = (100, 200)
                        )  
        panel = JPanel(GridLayout(0,1))
        frame.add(panel)                           

        print "in total  " + str(end_time - start_time) + " seconds for retrieval"
        
        if print_urls is True:
            # panel.add ( JLabel("vector space retreival" ) )
            for i in xrange(self.n_show):
                d = self.reader.document(doc_ids[i])			
                panel.add ( JLabel (d.getFieldable("path").stringValue().replace("%%", "/") ) )
                print "doc: [" + str(doc_ids[i]) + "], score: [" + str(score[doc_ids[i]]) +  "], url: " + d.getFieldable("path").stringValue().replace("%%", "/")

            if self.ah_flag is True:
                # panel.add ( Jlabel("authorities based retreival" ) )
                for i in xrange(self.n_show):
                    d = self.reader.document(auth_ids[i])			
                    panel.add (  JLabel (d.getFieldable("path").stringValue().replace("%%", "/") ) )

                # panel.add ( JLabel("hubs based retreival" ) )
                for i in xrange(self.n_show):
                    d = self.reader.document(hub_ids[i])			
                    panel.add (  JLabel  ( d.getFieldable("path").stringValue().replace("%%", "/") ) )


            elif self.pr_flag is True:
                # panel.add ( JLabel("page rank based retreival" ) )
                for i in xrange(self.n_Show):
                    d = self.reader.document(pr_ids[i])			
                    panel.add ( JLabel ( d.getFieldable("path").stringValue().replace("%%", "/") ) )


        print  "retrieval complete. "
        print  "..........................................................................."
        frame.pack() 
        frame.visible = True            
        return d 
开发者ID:ragavvenkatesan,项目名称:SearchEngine,代码行数:57,代码来源:gui.py

示例7: _open

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
def _open():
    frame = JFrame('Galahad',
                   defaultCloseOperation=WindowConstants.EXIT_ON_CLOSE)
    panel = JPanel(GridLayout(5, 2))
    frame.add(panel)

    chosen_values = {}
    def create_file_choice_button(name, label_text):
        button = JButton('Click to select')
        label = JLabel(label_text)
        file_chooser = JFileChooser()
        
        def choose_file(event):
            user_did_choose_file = (file_chooser.showOpenDialog(frame) ==
                                   JFileChooser.APPROVE_OPTION)
            if user_did_choose_file:
                file_ = file_chooser.getSelectedFile();
                button.text = chosen_values[name] = str(file_)
        button.actionPerformed = choose_file

        panel.add(label)
        panel.add(button)

    create_file_choice_button('binary',     'Binary archive:')
    create_file_choice_button('source',     'Source archive:')
    create_file_choice_button('output_dir', 'Output directory:')

    panel.add(JLabel(''))
    panel.add(JLabel(''))

    def run_fn(event):
        log_window = JFrame('Galahad Log')
        log_text_area = JTextArea()
        log_text_area.editable = False
        log_window.setSize(400, 500)
        log_window.add(log_text_area)
        log_window.show()
        log_text_area.append('sdfsdfsdfsdfsd %d' % 3)
        
    panel.add(JButton('Run analysis', actionPerformed=run_fn))
    panel.add(JButton('Quit', actionPerformed=lambda e: sys.exit(0)))

    frame.setSize(300, 160)
    frame.visible = True
开发者ID:bjartem,项目名称:lancelot-eclipse,代码行数:46,代码来源:gui.py

示例8: startGui

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
 def startGui(self):
     frame = JFrame("Life", defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
     (R, C) = (self.numRows, self.numCols)
     gridPanel = JPanel(GridLayout(R, C))
     self.checkBoxes = [[JCheckBox() for c in range(C)] for r in range(R)]
     self.grid = [[False for c in range(C)] for r in range(R)]
     for r in range(R):
         for c in range(C):
             gridPanel.add(self.checkBoxes[r][c])
     frame.add(gridPanel)
     buttonPanel = JPanel(FlowLayout())
     stepButton = JButton("Step", actionPerformed=self._step)
     runButton = JToggleButton("Run", actionPerformed=self._run)
     buttonPanel.add(stepButton)
     buttonPanel.add(runButton)
     frame.add(buttonPanel, SOUTH)
     frame.pack()
     frame.locationRelativeTo = None
     frame.visible = True
开发者ID:dcbriccetti,项目名称:python-lessons,代码行数:21,代码来源:life1.py

示例9: menuItemClicked

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
    def menuItemClicked(self, caption, messageInfo):
        response = messageInfo[0].getResponse()
        strResponse = ''.join([chr(c%256) for c in response])
        frame = JFrame('DOM XSS',size = (300,300))
        parentPanel = JPanel()


        #printedCode = JTextPane(text = strResponse)
        #'''
        #colored code
        printedCode = JTextPane()
        styledDoc = printedCode.getStyledDocument()
        style = printedCode.addStyle('ColoredCode',None)
        self.filter2(strResponse,styledDoc,style)
        #'''
        #Scroll Bar
        scrollPanel = JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)
        scrollPanel.preferredSize = 1500,800
        scrollPanel.viewport.view = printedCode

        #Final Inclusion of Panels
        parentPanel.add(scrollPanel)
        frame.add(parentPanel)
        frame.visible = True
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:26,代码来源:DOM_XSS_Hilight.py

示例10: createMainWindow

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
def createMainWindow():
	# Create window
	frame = JFrame('Epiphany Core Visualisation',
		defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
		size = (660,675)
	)

	# Main layout
	mainLayout = JPanel()
	frame.add(mainLayout)

	# Title
	#title = JLabel('hello', JLabel.CENTER)
	#mainLayout.add(title)

	# Cores
	corepanel = JPanel(GridLayout(8,8))
	global cores
	cores = []
	for i in range(0,64):
		core = JPanel(GridLayout(2,1))
		core.setPreferredSize(Dimension(80,80))
		corename = '(' + str(i%8) + ',' + str(i/8) + ')'
                namelabel = JLabel(corename, JLabel.CENTER)
		namelabel.setFont(Font("Dialog", Font.PLAIN, 18))
		portname = str(i+MINPORT)
		portlabel = JLabel(portname, JLabel.CENTER)
	        portlabel.setFont(Font("Dialog", Font.PLAIN, 16))
		core.add(namelabel)
		core.add(portlabel)
		core.setBackground(Color.BLACK)
		corepanel.add(core)
		cores.append(core)
	mainLayout.add(corepanel)

	frame.visible = True
开发者ID:futurecore,项目名称:epiphany-visualtest,代码行数:38,代码来源:visualise.py

示例11: JFrame

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
vdata = mdi.getGridData('V')

#---- Create wind vector layer from the U/V grid data
layer = DrawMeteoData.createGridVectorLayer(udata, vdata,  'UV_Vector', True)
#layer = DrawMeteoData.createGridBarbLayer(udata, vdata,  'UV_Barb', True)
#layer = DrawMeteoData.createStreamlineLayer(udata, vdata, 'Z_Streamline', True)

#---- Add layer
mapFrame.addLayer(layer)

#--- Move pressure layer to bottom
mapFrame.moveLayer(layer, 0)

#---- Add title
title = mapLayout.addText('MeteoInfo script demo', 350, 30, 'Arial', 16)

#---- Add wind arrow
windArrow = mapLayout.addWindArrow(660, 420)

#---- Zoom layout map
print 'Zoom layout map...'
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(Extent(70, 140, 15, 55))

#---- Set mapframe
mapFrame.setGridXDelt(10)
mapFrame.setGridYDelt(10)

frame = JFrame('MeteoInfo Script Sample', size = (800, 600))
frame.add(mapLayout)
frame.visible = True
print 'Finished!'
开发者ID:huangynj,项目名称:MeteoInfoWeb,代码行数:33,代码来源:tutorial_8_grid_uv.py

示例12: main

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
def main():
	
	binNaviProxy = StandAlone.getPluginInterface()
	binNaviProxy.databaseManager.addDatabase("","com.mysql.jdbc.Driver","localhost","BINNAVI1","binnavi","binnavi",False,False)
	db=binNaviProxy.databaseManager.databases[0]
	db.connect()
	db.load()
	mods=db.getModules()
	
	### initiate dialogBox to setect the module that should be used.
	
	######################################################
	
	
	frame = JFrame('BinNavi Module Selector',layout=BorderLayout(),		
				defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
				size = (1500, 800)
			)
	frame2 = JFrame('Function Selector',layout=BorderLayout(),		
				defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
				size = (30, 30)
			)
			
	frame2.setFocusableWindowState(False)
	frame2.setFocusable(False)
	frame2.setAlwaysOnTop(False)
	#convert the module list into the string to be used in the TextBox.
	textTemp = map((lambda x,y:"[%d]%s"%(x,y)),range(len(mods)),mods) 
	textStr=''.join(textTemp)

	tx=JTextArea(textStr)
	tx.setLineWrap(True);
	tx.setWrapStyleWord(True);
	frame.add(tx,BorderLayout.PAGE_START)
	frame.visible = True
	modInd = JOptionPane.showInputDialog(frame2, "Enter the index of the chosen module", 
			 "Module selector");
	
	#Open the module returned by the index 
	bfname=mods[int(modInd)] # this modules correxponds to the chosen module
	bfname.load()
	funcViews=bfname.views
	#textTemp2 = ["[%d]%s"%(i,j) for i in range(len(funcViews)) for j in funcViews]
	textTemp2=map((lambda x,y:"[%d]%s"%(x,y.toString()[5:18])),range(len(funcViews)),funcViews)
	textStr1=''.join(textTemp2)
	## remove the older text from the frame view
	frame.remove(tx)
	frame.update(frame.getGraphics())
	frame.visible = False
	## create a new textArea with the string made from all the functions' name
	txStr=JTextArea(textStr1)
	#tx.setsrcollOffset(20)
	txStr.setLineWrap(True);
	txStr.setWrapStyleWord(True);
	frame.add(txStr,BorderLayout.PAGE_START)
	frame.update(frame.getGraphics())
	frame.visible = True
	funcInd = JOptionPane.showInputDialog(frame2, "Enter the index of the function", 
			 "Function selector");
   
 ######################################################
	
	
	bffunc=bfname.views[int(funcInd)] #this is the view of the buildfname function
	bffunc.load()
	
	frame2.setVisible(False)
	dispose(frame2)
	
	bfReil=bffunc.getReilCode() # this is the REIL code of the function
	bfReilGraph=bfReil.getGraph()
			
	instGraph = InstructionGraph.create(bfReilGraph)
	time.clock()
	results=doAnalysis(instGraph)
	totalTime=time.clock()
	#print "resultsLen", len([r for r in results])
			
	print "**** printing results *******\n"
	print "Total time:", totalTime, '\n'
	numNode=0
	for n in instGraph:
		numNode+=numNode
		
		nIn=list(results.getState(n).inVal)
		nIn.sort(key=itemgetter(0))
		nOut=list(results.getState(n).out)
		nOut.sort(key=itemgetter(0))
		print '@@ ',n.getInstruction(),'\n'
		print '\t In', nIn, '\n'
		print '\t OUT', nOut, '\n'
		print '\t memory: ',results.getState(n).memoryWritten, '\n'
	print "++++ Total instructions: %d +++++\n"%numNode		 
	#finally close the view of the function
	bffunc.close()
	#print bffunc.isLoaded()
	#junky=raw_input("function closed. enter any charater")
	


#.........这里部分代码省略.........
开发者ID:gitttt,项目名称:VSA,代码行数:103,代码来源:vsaIntraMySQL.py

示例13: main

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
def main():
    '''
    Main function that implements main algorithm
    
    '''
    # a file where some log will be created which says how many functions are discovered etc.
    logFile=raw_input("Enter the name of log file")
    # this is provided as an extra file which is a pickled file comtains a list of functions
    # that are found to be BOP. Its main purpose is: if you want to use these functions for some
    # other analysis, just load this file and viola!!!
    fileBOP=raw_input("Enter the file name (full path) to store (Pickled) BOP function's name: ")
    
    interestingFuncs={} # dictionary of interesting functions
    interestingFuncsLOC={} # dictionary of LOC in interesting functions

    binNaviProxy = StandAlone.getPluginInterface()
    
    ################## place to set database connectivity parameter ######### 
    binNaviProxy.databaseManager.addDatabase("","org.postgresql.Driver","localhost","DataBase_name","user","password",False,False)
    ########################################################################
    db=binNaviProxy.databaseManager.databases[0]
    db.connect()
    db.load()
    mods=db.getModules()

    ### initiate dialogBox to setect the module that should be used.

    ######################################################


    frame = JFrame('BinNavi Module Selector',layout=BorderLayout(),
                defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                size = (500, 500)
            )
    frame2 = JFrame('Function Selector',layout=BorderLayout(),
                defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                size = (30, 30)
            )


    #convert the module list into the string to be used in the TextBox.
    ## This gives a very ugly box to select the required function (yes, I am bit lazy to learn Java Swing!!). 
    textTemp = map((lambda x,y:"[%d]%s"%(x,y)),range(len(mods)),mods)
    textStr=''.join(textTemp)

    tx=JTextArea(textStr)
    tx.setLineWrap(True);
    tx.setWrapStyleWord(True);
    frame.add(tx,BorderLayout.PAGE_START)
    frame.visible = True
    modInd = JOptionPane.showInputDialog(frame2, "Enter the index of the chosen module",
             "Module selector");

    #Open the module returned by the index
    bfname=mods[int(modInd)] # this modules correxponds to the chosen module
    bfname.load()
    funcViews=bfname.views

    frame2.setVisible(False)
    dispose(frame2)

 ######################################################
    analyzedFunctions = 0
    totalDiscoveredLoops=0
    totalInterestingLoops=0
    time.clock()
    for funcInd in range(1,len(funcViews)):
        
        BBnum=funcViews[funcInd].getNodeCount()
        
        if BBnum <4:
            print "skipped"
            continue #do not analyse function if num of BB less than 4
        
        print 'analyzing %s'%funcViews[funcInd].getName()

        dominatingSets={}#dictionary to keep dominating nodes of a node

        bffunc=bfname.views[int(funcInd)] #this is the view of the buildfname function
        bffunc.load()
        try:
            bfReil=bffunc.getReilCode() # this is the REIL code of the function
        except:
            print "error in getReilCode()"
            bffunc.close()
            gc.collect()
            continue

        bfReilGraph=bfReil.getGraph()
        try:
            #dominatorTree = GraphAlgorithms.getDominatorTree(bfReilGraph, findRoot(bfReilGraph.getNodes())) #only for BinNavi v 3.0
            dominatorTree = GraphAlgorithms.getDominatorTree(bfReilGraph, findRoot(bfReilGraph.getNodes()),None)
        except:
            print "dominator tree problem.. continue with the next function"
            bffunc.close()
            gc.collect()
            continue

        fillDominatingSets(dominatorTree.getRootNode(), dominatingSets, None)

#.........这里部分代码省略.........
开发者ID:cherry-wb,项目名称:BOPFunctionRecognition,代码行数:103,代码来源:BOPFunctionRecognition_simple.py

示例14: JFrame

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
# http://www.jython.org/jythonbook/en/1.0/GUIApplications.html
from java.awt import Component
from javax.swing import JTextArea, JFrame

import time

frame = JFrame('Message',
            defaultCloseOperation = JFrame.DO_NOTHING_ON_CLOSE,
            size = (300, 300)
        )

t = JTextArea(text = 'Hello\nworld',
              editable = False,
              wrapStyleWord = True,
              lineWrap = True,
              alignmentX = Component.LEFT_ALIGNMENT,
              size = (300, 1)
             )
frame.add(t)
frame.visible = True
sleep(2)
frame.visible = False
sleep(0.5)
t.text = "{}\n{}".format("Hello",time.asctime())
frame.visible = True
sleep(2)
frame.visible = False
frame.dispose()
frame = None
开发者ID:haru-a8n,项目名称:CodeSamples,代码行数:31,代码来源:ShowMessage.py

示例15: __init__

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import visible [as 别名]
    def __init__(self):
        """ setting up flags in this section """
        verbose = False					# if true prints a lot of stuff.. if false goes a little quiter
        create_lexicon_flag = True  	# if true will rebuild lexicon from scratch, if false will load a pre-created one as supplied in sys_arg[1]
        create_page_rank_flag = False    # same as for create page rank... default load file is 'page_rank' with loader extension
        normalize = True 				# will use document norms and normalized tf-idf, false will not.
        n_retrieves = 50   				# number of documents to retreive
        root_set_size = 50
        tf_idf_flag = True 		    # True retrieves based on Tf/idf, False retrieves based on only Tf. 
        directory = '../index'			# directory of index
        linksFile = "../index/IntLinks.txt"
        citationsFile = "../index/IntCitations.txt"    
        maxIter = 100    

        ah_flag = False
        pr_flag = False

        saver = json_down
        loader = json_up

        cluster_results = False
        num_clusters = 3


        if len(sys.argv) < 2:
            filename = 'temp'
        else:
            filename = sys.argv[1]

        frame = JFrame('Ragav\'s Search Engine',
                defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                size = (100, 100)
            )        
        panel = JPanel(GridLayout(0,2)) 
        frame.add(panel)           
        panel.add (JLabel("Loading please wait ... "))    
        frame.pack()
        frame.visible = True 
            
        start_time = time.clock()

        self.engine = search_gui ( 
                            filename = filename,
                            create_lexicon_flag = create_lexicon_flag, 
                            normalize = normalize,
                            directory = directory,
                            n_retrieves = n_retrieves,
                            cluster_results = cluster_results,
                            num_clusters = num_clusters,
                            maxIter = maxIter,
                            root_set_size = root_set_size,
                            tf_idf_flag = tf_idf_flag,
                            ah_flag = ah_flag,
                            pr_flag = pr_flag,
                            linksFile = linksFile,
                            create_page_rank_flag = create_page_rank_flag,
                            citationsFile = citationsFile,
                            saver = saver,
                            loader = loader,
                            verbose = verbose )
        end_time = time.clock()

        frame.visible = False
        if (end_time - start_time) > 60:
            message =  "finished loading in " + str((end_time - start_time)/60.) + " minutes" + "\n"
        else:
            message =  "finished loading in " + str(end_time - start_time) + " seconds" + "\n"
        
        print message
        
        frame = JFrame('Ragav\'s Search Engine',
                defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                size = (500, 50)
            )  
        panel = JPanel(GridLayout(0,2))
        frame.add(panel)                           
        self.query = JTextField('', 30)
        panel.add(self.query)       
        searchButton = JButton('Search', actionPerformed = self.run)
        panel.add(searchButton)    
        frame.visible = True   
开发者ID:ragavvenkatesan,项目名称:SearchEngine,代码行数:83,代码来源:gui.py


注:本文中的javax.swing.JFrame.visible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。